Browse Source

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/branches/branch-0.18@675779 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 years ago
parent
commit
718e3e9bfd
2 changed files with 6 additions and 6 deletions
  1. 3 0
      CHANGES.txt
  2. 3 6
      src/core/org/apache/hadoop/fs/kfs/KFSOutputStream.java

+ 3 - 0
CHANGES.txt

@@ -741,6 +741,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 {