瀏覽代碼

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 年之前
父節點
當前提交
718e3e9bfd
共有 2 個文件被更改,包括 6 次插入6 次删除
  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.
     prevents it from loading user-specified InputFormats.
     (Jingkei Ly via cdouglas)
     (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
 Release 0.17.2 - Unreleased
 
 
   BUG FIXES
   BUG FIXES

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

@@ -55,13 +55,10 @@ class KFSOutputStream extends OutputStream {
         if (kfsChannel == null) {
         if (kfsChannel == null) {
             throw new IOException("File closed");
             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 {
     public void write(byte b[], int off, int len) throws IOException {