Ver Fonte

HADOOP-9665. Fixed BlockDecompressorStream#decompress to return -1 rather than throw EOF at end of file. Contributed by Zhijie Shen.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1-win@1507479 13f79535-47bb-0310-9956-ffa450edef68
Chris Nauroth há 12 anos atrás
pai
commit
cf54349b0d

+ 3 - 0
CHANGES.branch-1-win.txt

@@ -472,3 +472,6 @@ Branch-hadoop-1-win (branched from branch-1 at r1293509 on 2012-02-24 17:46:42)
 
     HADOOP-9507. LocalFileSystem rename() is broken in some cases when
     destination exists. (cnauroth)
+
+    HADOOP-9665. Fixed BlockDecompressorStream#decompress to return -1 rather
+    than throw EOF at end of file. (Zhijie Shen via acmurthy)

+ 7 - 1
src/core/org/apache/hadoop/io/compress/BlockDecompressorStream.java

@@ -81,7 +81,13 @@ public class BlockDecompressorStream extends DecompressorStream {
         }
       }
       if (decompressor.needsInput()) {
-        int m = getCompressedData();
+        int m;
+        try {
+          m = getCompressedData();
+        } catch (EOFException e) {
+          eof = true;
+          return -1;
+        }
         // Send the read data to the decompressor
         decompressor.setInput(buffer, 0, m);
       }

+ 1 - 0
src/test/commit-tests

@@ -5,6 +5,7 @@
 **/TestAuthenticationFilter.java
 **/TestAuthenticationToken.java
 **/TestAuthenticatedURL.java
+**/TestBlockDecompressorStream.java
 **/TestBloomMapFile.java
 **/TestBuffer.java
 **/TestBytesWritable.java