hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r1031948 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/net/SocketInputStream.java src/test/core/org/apache/hadoop/net/TestSocketIOWithTimeout.java
Date Sat, 06 Nov 2010 03:13:42 GMT
Author: tomwhite
Date: Sat Nov  6 03:13:42 2010
New Revision: 1031948

URL: http://svn.apache.org/viewvc?rev=1031948&view=rev
Log:
HADOOP-6926. SocketInputStream incorrectly implements read(). Contributed by Todd Lipcon.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/net/SocketInputStream.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/net/TestSocketIOWithTimeout.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1031948&r1=1031947&r2=1031948&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Sat Nov  6 03:13:42 2010
@@ -306,6 +306,9 @@ Trunk (unreleased changes)
     HADOOP-6758. MapFile.fix does not allow index interval definition.
     (Gianmarco De Francisci Morales via tomwhite)
 
+    HADOOP-6926. SocketInputStream incorrectly implements read().
+    (Todd Lipcon via tomwhite)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/net/SocketInputStream.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/net/SocketInputStream.java?rev=1031948&r1=1031947&r2=1031948&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/net/SocketInputStream.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/net/SocketInputStream.java Sat Nov  6 03:13:42
2010
@@ -119,7 +119,7 @@ public class SocketInputStream extends I
     byte[] buf = new byte[1];
     int ret = read(buf, 0, 1);
     if (ret > 0) {
-      return (byte)buf[0];
+      return (int)(buf[0] & 0xff);
     }
     if (ret != -1) {
       // unexpected

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/net/TestSocketIOWithTimeout.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/net/TestSocketIOWithTimeout.java?rev=1031948&r1=1031947&r2=1031948&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/net/TestSocketIOWithTimeout.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/net/TestSocketIOWithTimeout.java Sat
Nov  6 03:13:42 2010
@@ -101,12 +101,15 @@ public class TestSocketIOWithTimeout ext
       
       byte[] writeBytes = TEST_STRING.getBytes();
       byte[] readBytes = new byte[writeBytes.length];
+      byte byteWithHighBit = (byte)0x80;
       
       out.write(writeBytes);
+      out.write(byteWithHighBit);
       doIO(null, out);
       
       in.read(readBytes);
       assertTrue(Arrays.equals(writeBytes, readBytes));
+      assertEquals(byteWithHighBit & 0xff, in.read());
       doIO(in, null);
       
       /*



Mime
View raw message