You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/03/26 00:36:57 UTC
svn commit: r641076 - in /tomcat/trunk/java/org/apache/catalina/connector:
InputBuffer.java LocalStrings.properties
Author: markt
Date: Tue Mar 25 16:36:56 2008
New Revision: 641076
URL: http://svn.apache.org/viewvc?rev=641076&view=rev
Log:
Fix bug 44673. Throw IOE if stream is closed and a call is made to any read(), ready(), mark(), reset(), or skip() method as per javadocs for Reader.
Modified:
tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java
tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
Modified: tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java?rev=641076&r1=641075&r2=641076&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Tue Mar 25 16:36:56 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
@@ -285,12 +291,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);
}
@@ -346,18 +360,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);
}
@@ -365,6 +391,10 @@
public long skip(long n)
throws IOException {
+
+ if (closed)
+ throw new IOException(sm.getString("inputBuffer.streamClosed"));
+
if (n < 0) {
throw new IllegalArgumentException();
}
@@ -396,6 +426,10 @@
public boolean ready()
throws IOException {
+
+ if (closed)
+ throw new IOException(sm.getString("inputBuffer.streamClosed"));
+
return (available() > 0);
}
@@ -407,6 +441,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);
@@ -430,6 +468,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/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=641076&r1=641075&r2=641076&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Tue Mar 25 16:36:56 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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org