I was thinking that the only reason for memory leakage would be a failure to
exit the loop, and was thinking of what conditions might cause this.
It may not be the case in practice, but I thought the read method might return
zero bytes under some circumstances, and was thinking that perhaps you should
exit the loop in this circumstance.
Of course the spec for InputStream says -1 on EOF and IOError for any other
error; but I'm not sure if the servlet engine would rigorously enforce this.
It's possible that a socket-level IOException is caught in the
ServletxxxStreams but not propagated upwards.
The most natural way to handle an error would of course be an IOException, but
if this is not being thrown then I suppose a bit of experimentation is called
for!
I was thinking that the only reason for memory leakage would be a failure to exit the loop, and was thinking of what conditions might cause this.
It may not be the case in practice, but I thought the read method might return zero bytes under some circumstances, and was thinking that perhaps you should exit the loop in this circumstance.
Of course the spec for InputStream says -1 on EOF and IOError for any other error; but I'm not sure if the servlet engine would rigorously enforce this. It's possible that a socket-level IOException is caught in the ServletxxxStreams but not propagated upwards.
The most natural way to handle an error would of course be an IOException, but if this is not being thrown then I suppose a bit of experimentation is called for!