tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 水野謙 <mizuno....@interfactory.co.jp>
Subject ArrayIndexOutOfBoundsException in ServletInputStream.readLine
Date Thu, 16 Feb 2017 03:10:57 GMT
Dear Sirs,

I'm using Apache Tomcat/6.0.48 on Linux and I sometimes see the
following exception.

java.lang.ArrayIndexOutOfBoundsException: 8192
at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:391)
at org.apache.catalina.connector.InputBuffer.readByte(InputBuffer.java:318)
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:105)
at javax.servlet.ServletInputStream.readLine(ServletInputStream.java:94)
at org.apache.catalina.connector.CoyoteInputStream.readLine(CoyoteInputStream.java:199)
at jp.co.interfactory.framework.MultiPartParser.retrieveParts(MultiPartParser.java:79)

"MultiPartParser.retrieveParts" is my application and calls readLine
method as follows:
(The actual program is more complicated and I extracted the code
related to the input stream)

        byte[] buf = new byte[8 * 1024];
        ServletInputStream istream = request.getInputStream();
        while ((ret = istream.readLine(buf, 0, buf.length)) > -1) {
            // ...
        }

I cannot reproduce this exception but I observe it every couple of
months in our production servers.
I saw the similar exception when I used Apache Tomcat/6.0.44 and the
stacktrace was as follows:

java.lang.ArrayIndexOutOfBoundsException: 8192
at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:391)
at org.apache.catalina.connector.InputBuffer.readByte(InputBuffer.java:317)
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:105)
at javax.servlet.ServletInputStream.readLine(ServletInputStream.java:94)
at org.apache.catalina.connector.CoyoteInputStream.readLine(CoyoteInputStream.java:199)
at jp.co.interfactory.framework.MultiPartParser.retrieveParts(MultiPartParser.java:79)


Best Regards

Ken Mizuno
mizuno.ken@interfactory.co.jp

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message