You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Ignacio J. Ortega" <na...@siapi.es> on 2001/04/19 09:59:31 UTC
RE: Bug in tomcat3.2.1 RecycleBufferedInputStream class - or solu
tion to ContextManager: error reading request:ArrayIndexOutOfBoundsExcept
ion
Please file a bug in <http://nagoya.apache.org/bugzilla> and attach a
patch following the directions provided in
<http://jakarta.apache.org/site/source.html>
TIA
Saludos ,
Ignacio J. Ortega
> -----Mensaje original-----
> De: Animesh Chaturvedi - US [mailto:animeshc@allegronetworks.com]
> Enviado el: jueves 19 de abril de 2001 2:48
> Para: 'tomcat-user@jakarta.apache.org'
> Asunto: Bug in tomcat3.2.1 RecycleBufferedInputStream class - or
> solution to ContextManager: error reading
> request:ArrayIndexOutOfBoundsException
>
>
>
> Hi
>
> Tomcct 3.2.1 does not work with Kaffe JVM. When a request is
> sent to Tomcat
>
> you get following error
>
> ContextManager: Error reading request, ignored -
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(System.java:native)
> at
> java.io.BufferedInputStream.read(BufferedInputStream.java:118)
> at
> java.io.BufferedInputStream.read(BufferedInputStream.java:69)
> at
> org.apache.tomcat.service.http.HttpRequestAdapter.doRead(HttpR
> equestAdapter.
> java:115)
> at
> org.apache.tomcat.core.BufferedServletInputStream.doRead(Buffe
> redServletInpu
> tStream.java:106)
> at
> org.apache.tomcat.core.BufferedServletInputStream.read(Buffere
> dServletInputS
> tream.java:128)
> at
> javax.servlet.ServletInputStream.readLine(ServletInputStream.j
> ava:138)
> at
> org.apache.tomcat.service.http.HttpRequestAdapter.readNextRequ
> est(HttpReques
> tAdapter.java:129)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processCo
> nnection(HttpC
> onnectionHandler.java:195)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> t.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> ol.java:498)
> at java.lang.Thread.run(Thread.java:325)
>
>
> After lot of debugging I found that there is bug with
> RecycleBufferedInputStream.
> The original RecycleBufferedInputStream class only resets count = 0.
> This results sometimes in count to be set to zero and pos is
> not changed so
> it is now greater than count. and
> when yo do a System.arraycopy with length = count -pos. It
> gets a negative
> value hence the array index out of bounds exception.
>
> So you have to change the two functions in
> RecycleBufferedInputStream like
> this.
>
> public void setInputStream( InputStream is ) {
> this.in = is;
> this.pos = this.count = 0;
> this.markpos = -1;
> }
>
> public void recycle() {
> this.in = null;
> this.pos = this.count = 0;
> this.markpos = -1;
> }
>
>
> Now tomcat 3.2.1 works fine with Kaffe VM.
>
>
> Animesh
>