https://weblets.dev.java.net/issues/show_bug.cgi?id=15
Issue #|15
Summary|Request for a image file logs
exception
Component|weblets
Version|current
Platform|PC
OS/Version|Windows XP
URL|
Status|NEW
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P3
Subcomponent|container
Assigned to|jfallows
Reported by|sjoglesby
------- Additional comments from sjoglesby dev.java.net Thu May 25 09:41:18 +0000 2006 -------
When requesting a gif file the following exception is
logged. (Running in
Tomcat 5.5). File is served OK, but exception is logged.
ArrayIndexOutOfBoundsException thrown by
PackagedServlet.service() (line 146).
Section of code shown below:
byte[] buffer = new byte[1024];
while (in.available() > 0)
{
int len = in.read(buffer);
out.write(buffer, 0, len);
}
The len read from the input stream is -1 when the end is
reached. The available
method only seems to start returning 0 after you have hit
the end of the stream
by attempting a read that returns -1 (seems a little odd it
does not work
correctly if you could only read < 1024 bytes in a
previous read call - looks
like a problem with InflaterInputStream used for ZipFiles).
The write call throws the exception when len is -1.
I guess len should be checked before doing the write.
------------------------------------------------------------
---------
To unsubscribe, e-mail: issues-unsubscribe weblets.dev.java.net
For additional commands, e-mail: issues-help weblets.dev.java.net
|