Quellcode durchsuchen

HADOOP-3718. Fix KFSOutputStream::write(int) to output a byte instead of
an int, per the OutputStream contract. Contributed by Sriram Rao.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@675778 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas vor 17 Jahren
Ursprung
Commit
2e6ebd3ce7
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. 3 0
      CHANGES.txt
  2. 3 6
      src/core/org/apache/hadoop/fs/kfs/KFSOutputStream.java

+ 3 - 0
CHANGES.txt

@@ -808,6 +808,9 @@ Release 0.18.0 - Unreleased
     prevents it from loading user-specified InputFormats.
     (Jingkei Ly via cdouglas)
 
+    HADOOP-3718. Fix KFSOutputStream::write(int) to output a byte instead of
+    an int, per the OutputStream contract. (Sriram Rao via cdouglas)
+
 Release 0.17.2 - Unreleased
 
   BUG FIXES

+ 3 - 6
src/core/org/apache/hadoop/fs/kfs/KFSOutputStream.java

@@ -55,13 +55,10 @@ class KFSOutputStream extends OutputStream {
         if (kfsChannel == null) {
             throw new IOException("File closed");
         }
-        byte[] b = new byte[4];
+        byte[] b = new byte[1];
 
-        b[0] = (byte) (v & 0xFF);
-        b[1] = (byte) ((v >> 8) & 0xFF);
-        b[1] = (byte) ((v >> 16) & 0xFF);
-        b[1] = (byte) ((v >> 24) & 0xFF);
-        write(b, 0, 4);
+        b[0] = (byte) v;
+        write(b, 0, 1);
     }
 
     public void write(byte b[], int off, int len) throws IOException {