Author: costin Date: Sat Nov 19 21:22:24 2005 New Revision: 345722 URL: http://svn.apache.org/viewcvs?rev=345722&view=rev Log: Some extra checks
Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=345722&r1=345721&r2=345722&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Sat Nov 19 21:22:24 2005 @@ -44,7 +44,7 @@ * Default constructor. */ public InternalAprOutputBuffer(Response response) { - super(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); + this(response, Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); } @@ -60,6 +60,7 @@ // Cause loading of HttpMessages HttpMessages.getMessage(200); + socketBuffer=null; } // ----------------------------------------------------- Instance Variables Modified: tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java?rev=345722&r1=345721&r2=345722&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java (original) +++ tomcat/sandbox/java/org/apache/coyote/http11/InternalOutputBuffer.java Sat Nov 19 21:22:24 2005 @@ -207,7 +207,8 @@ * Set the socket buffer size. */ public void setSocketBuffer(int socketBufferSize) { - + + if( socketBuffer == null ) return; if (socketBufferSize > 500) { useSocketBuffer = true; socketBuffer.allocate(socketBufferSize, socketBufferSize); @@ -300,7 +301,7 @@ } // Flush the current buffer - if (useSocketBuffer) { + if (useSocketBuffer && socketBuffer != null ) { socketBuffer.flushBuffer(); } @@ -331,7 +332,9 @@ // Recycle Request object response.recycle(); - socketBuffer.recycle(); + if( socketBuffer != null ) { + socketBuffer.recycle(); + } outputStream = null; buf = headerBuffer; @@ -353,7 +356,10 @@ // Recycle Request object response.recycle(); - socketBuffer.recycle(); + // this is not used in apr + if( socketBuffer != null ) { + socketBuffer.recycle(); + } // Determine the header buffer used for next request buf = headerBuffer; @@ -395,7 +401,7 @@ if (lastActiveFilter != -1) activeFilters[lastActiveFilter].end(); - if (useSocketBuffer) { + if (useSocketBuffer && socketBuffer != null ) { socketBuffer.flushBuffer(); } @@ -455,6 +461,8 @@ } // End the response status line + // This was missing in APR ! + // Why is this needed ???? if (System.getSecurityManager() != null){ AccessController.doPrivileged( new PrivilegedAction(){ @@ -472,7 +480,7 @@ } - private String getMessage(final int message){ + protected String getMessage(final int message){ if (System.getSecurityManager() != null){ return (String)AccessController.doPrivileged( new PrivilegedAction(){ @@ -598,7 +606,7 @@ if (pos > 0) { // Sending the response header buffer - if (useSocketBuffer) { + if (useSocketBuffer && socketBuffer != null) { socketBuffer.append(buf, 0, pos); } else { outputStream.write(buf, 0, pos); @@ -765,7 +773,7 @@ public int doWrite(ByteChunk chunk, Response res) throws IOException { - if (useSocketBuffer) { + if (useSocketBuffer && socketBuffer != null ) { socketBuffer.append(chunk.getBuffer(), chunk.getStart(), chunk.getLength()); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]