Author: remm
Date: Fri Mar 21 19:55:48 2014
New Revision: 1580033

URL: http://svn.apache.org/r1580033
Log:
Forgot to check the return value for blocking writes as all other places do, 
oops (some platforms could be returning a negative value after a disconnect 
rather than throw an exception).

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1580033&r1=1580032&r2=1580033&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Fri Mar 21 19:55:48 2014
@@ -384,12 +384,16 @@ public class InternalNio2OutputBuffer ex
                     if (bufferedWrites.size() > 0) {
                         for (ByteBuffer buffer : bufferedWrites) {
                             buffer.flip();
-                            
socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+                            if 
(socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS).intValue() < 0) {
+                                throw new 
EOFException(sm.getString("iob.failedwrite"));
+                            }
                         }
                         bufferedWrites.clear();
                     }
                     if (byteBuffer.hasRemaining()) {
-                        
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+                        if 
(socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS).intValue() < 0) {
+                            throw new 
EOFException(sm.getString("iob.failedwrite"));
+                        }
                     }
                 } catch (InterruptedException | ExecutionException e) {
                     throw new IOException(e);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to