Author: markt Date: Sat Apr 5 11:14:16 2008 New Revision: 645155 URL: http://svn.apache.org/viewvc?rev=645155&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44673 ServletInputStream is no longer readable once closed.
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=645155&r1=645154&r2=645155&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Apr 5 11:14:16 2008 @@ -96,12 +96,6 @@ +1: markt, rjung, fhanik -1: -* Fix ServletInputStream still readable when closed - https://issues.apache.org/bugzilla/show_bug.cgi?id=44673 - http://svn.apache.org/viewvc?rev=641076&view=rev - +1: markt, remm, fhanik - -1: - * Document missing secret attributes https://issues.apache.org/bugzilla/show_bug.cgi?id=44715 http://svn.apache.org/viewvc?rev=643497&view=rev Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java?rev=645155&r1=645154&r2=645155&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java Sat Apr 5 11:14:16 2008 @@ -25,6 +25,7 @@ import java.util.HashMap; import org.apache.catalina.security.SecurityUtil; +import org.apache.catalina.util.StringManager; import org.apache.coyote.ActionCode; import org.apache.coyote.Request; import org.apache.tomcat.util.buf.B2CConverter; @@ -44,6 +45,12 @@ implements ByteChunk.ByteInputChannel, CharChunk.CharInputChannel, CharChunk.CharOutputChannel { + /** + * The string manager for this package. + */ + protected static StringManager sm = + StringManager.getManager(Constants.Package); + // -------------------------------------------------------------- Constants @@ -58,7 +65,6 @@ public final int CHAR_STATE = 1; public final int BYTE_STATE = 2; - // ----------------------------------------------------- Instance Variables @@ -304,12 +310,20 @@ public int readByte() throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + return bb.substract(); } public int read(byte[] b, int off, int len) throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + return bb.substract(b, off, len); } @@ -365,18 +379,30 @@ public int read() throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + return cb.substract(); } public int read(char[] cbuf) throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + return read(cbuf, 0, cbuf.length); } public int read(char[] cbuf, int off, int len) throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + return cb.substract(cbuf, off, len); } @@ -384,6 +410,10 @@ public long skip(long n) throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + if (n < 0) { throw new IllegalArgumentException(); } @@ -415,6 +445,10 @@ public boolean ready() throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + return (available() > 0); } @@ -426,6 +460,10 @@ public void mark(int readAheadLimit) throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + if (cb.getLength() <= 0) { cb.setOffset(0); cb.setEnd(0); @@ -449,6 +487,10 @@ public void reset() throws IOException { + + if (closed) + throw new IOException(sm.getString("inputBuffer.streamClosed")); + if (state == CHAR_STATE) { if (markPos < 0) { cb.recycle(); Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=645155&r1=645154&r2=645155&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties Sat Apr 5 11:14:16 2008 @@ -17,7 +17,6 @@ # # CoyoteConnector # - coyoteConnector.alreadyInitialized=The connector has already been initialized coyoteConnector.alreadyStarted=The connector has already been started coyoteConnector.cannotRegisterProtocol=Cannot register MBean for the Protocol @@ -32,18 +31,15 @@ coyoteConnector.MapperRegistration=register Mapper: {0} coyoteConnector.protocolUnregistrationFailed=Protocol handler stop failed - # # CoyoteAdapter # - coyoteAdapter.service=An exception or error occurred in the container during the request processing coyoteAdapter.read=The servlet did not read all available bytes during the processing of the read event # # CoyoteResponse # - coyoteResponse.getOutputStream.ise=getWriter() has already been called for this response coyoteResponse.getWriter.ise=getOutputStream() has already been called for this response coyoteResponse.resetBuffer.ise=Cannot reset buffer after response has been committed @@ -54,7 +50,6 @@ # # CoyoteRequest # - coyoteRequest.getInputStream.ise=getReader() has already been called for this request coyoteRequest.getReader.ise=getInputStream() has already been called for this request coyoteRequest.sessionCreateCommitted=Cannot create a session after the response has been committed @@ -64,8 +59,11 @@ coyoteRequest.attributeEvent=Exception thrown by attributes event listener coyoteRequest.parseParameters=Exception thrown whilst processing POSTed parameters coyoteRequest.postTooLarge=Parameters were not parsed because the size of the posted data was too big. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs. + requestFacade.nullRequest=The request object has been recycled and is no longer associated with this facade + responseFacade.nullResponse=The response object has been recycled and is no longer associated with this facade + cometEvent.nullRequest=The event object has been recycled and is no longer associated with a request # @@ -78,5 +76,4 @@ mapperListener.unregisterContext=Unregister Context {0} mapperListener.registerWrapper=Register Wrapper {0} in Context {1} - - +inputBuffer.streamClosed=Stream closed \ No newline at end of file Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=645155&r1=645154&r2=645155&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sat Apr 5 11:14:16 2008 @@ -64,6 +64,10 @@ Fix CGI Servlet so it correctly reads the environment variables on Vista. (markt) </fix> + <fix> + <bug>44673</bug>: ServletInputStream is no longer readable once closed. + (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]