Author: markt
Date: Mon Feb 27 11:13:45 2012
New Revision: 1294108

URL: http://svn.apache.org/viewvc?rev=1294108&view=rev
Log:
Fix NIO upgrade single byte read

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1294108&r1=1294107&r2=1294108&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java 
Mon Feb 27 11:13:45 2012
@@ -91,9 +91,12 @@ public class UpgradeNioProcessor extends
     @Override
     public int read() throws IOException {
         byte[] bytes = new byte[1];
-        readSocket(true, bytes, 0, 1);
-        return bytes[0];
-    }
+        int result = readSocket(true, bytes, 0, 1);
+        if (result == -1) {
+            return -1;
+        } else {
+            return bytes[0] & 0xFF;
+        }    }
 
     @Override
     public int read(byte[] bytes, int off, int len) throws IOException {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to