Fix for PR49595
authorjfclere <jfclere@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 19 Jul 2011 08:06:46 +0000 (08:06 +0000)
committerjfclere <jfclere@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 19 Jul 2011 08:06:46 +0000 (08:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1148216 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/ajp/AjpAprProcessor.java

index 275f255..96ded17 100644 (file)
@@ -507,13 +507,13 @@ public class AjpAprProcessor extends AbstractAjpProcessor<Long> {
         long socketRef = socket.getSocket().longValue();
         
         if (outputBuffer.position() > 0) {
-            if (Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
+            if ((socketRef != 0) && Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
                 throw new IOException(sm.getString("ajpprocessor.failedsend"));
             }
             outputBuffer.clear();
         }
         // Send explicit flush message
-        if (explicit && !finished) {
+        if (explicit && !finished &&  (socketRef != 0)) {
             if (Socket.send(socketRef, flushMessageArray, 0,
                     flushMessageArray.length) < 0) {
                 throw new IOException(sm.getString("ajpprocessor.failedflush"));