tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geoff...@fileflow.com
Subject Re: ArrayIndexOutOfBoundsException
Date Tue, 24 Nov 2009 17:17:59 GMT
The bytesRead returns the size of the buffer (8KB) every time. I also debug and I can't find
anything wrong. Input and OutputStream are not null, bytesRead is the correct size and the
buffer is also filled.

Any other ideas?


Best Regards

Geoffrey



On 24 Nov 2009, at 18:13, Ronald Klop wrote:

> Try insert some debug statements just before the out.write.
> System.out.println("bytesRead: " + bytesRead) would be interesting.
> 
> In fact this is kind of my-first-debugging and you don't even mention you did try it.
> 
> Ronald.
> 
> 
> Op dinsdag, 24 november 2009 17:57 schreef geoffrey@fileflow.com:
>> Hi everyone.
>> I'm stuck with a problem I don't understand. We have a tomcat server and after redeploying
our war file, we get this error:
>> java.lang.ArrayIndexOutOfBoundsException
>> at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346)
>> at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:764)
>> at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:118)
>> at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:573)
>> at org.apache.coyote.Response.doWrite(Response.java:560)
>> at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
>> at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:325)
>> at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
>> at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
>> at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
>> at com.fileflow.downloader.Downloader.doGet(Downloader.java:123)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>> at java.lang.Thread.run(Thread.java:619)
>> Notice that there are no number on the first line and it is usually the case.
>> The code that is "responsible is:
>> private ServletOutputStream out;
>> private InputStream in;
>> ...
>> in = new FileInputStream(tmp);
>> ...
>> out = response.getOutputStream();
>> byte[] buf = new byte[8 * 1024]; // 8K buffer
>> int bytesRead;
>> while((bytesRead = in.read(buf)) > 0) {
>> out.write(buf, 0, bytesRead);
>> }
>> The updated code didn't change anything in that Servlet so I really have no clue
what happened. It happens on tomcat 6.0.18 and 6.0.20. Java is 1.6.0_11.
>> Thanks for any help.
>> Best Regards
>> Geoffrey
> 


Mime
View raw message