Browse Source

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@1497938 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 12 năm trước cách đây
mục cha
commit
781452184b

+ 3 - 0
CHANGES.txt

@@ -102,6 +102,9 @@ Release 1.2.1 - Unreleased
 
     MAPREDUCE-5318. Escape ampersand in JSPUtil. (Bohou Li via acmurthy)
 
+    HADOOP-9665. Fixed BlockDecompressorStream#decompress to return -1 rather
+    than throw EOF at end of file. (Zhijie Shen via acmurthy)
+
 Release 1.2.0 - 2013.05.05
 
   INCOMPATIBLE CHANGES

+ 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