Explorar o código

HADOOP-219. Fix a NPE when handling a checksum exception under SequenceFile.Sorter.sort(). With help from Stack.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@406732 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting %!s(int64=19) %!d(string=hai) anos
pai
achega
74add90cac
Modificáronse 2 ficheiros con 12 adicións e 7 borrados
  1. 3 0
      CHANGES.txt
  2. 9 7
      src/java/org/apache/hadoop/io/SequenceFile.java

+ 3 - 0
CHANGES.txt

@@ -26,6 +26,9 @@ Trunk (unreleased)
     henceforth refer to them by number when collecting map output.
     (omalley via cutting)
 
+ 7. HADOOP-219. Fix a NullPointerException when handling a checksum
+    exception under SequenceFile.Sorter.sort().  (cutting & stack)
+
 
 Release 0.2.1 - 2006-05-12
 

+ 9 - 7
src/java/org/apache/hadoop/io/SequenceFile.java

@@ -235,23 +235,25 @@ public class SequenceFile {
     /** Open the named file. */
     public Reader(FileSystem fs, Path file, Configuration conf)
       throws IOException {
-      this(fs, file, conf.getInt("io.file.buffer.size", 4096));
-      this.conf = conf;
+      this(fs, file, conf.getInt("io.file.buffer.size", 4096), conf);
     }
 
-    private Reader(FileSystem fs, Path name, int bufferSize) throws IOException {
+    private Reader(FileSystem fs, Path name, int bufferSize,
+                   Configuration conf) throws IOException {
       this.fs = fs;
       this.file = name;
       this.in = fs.open(file, bufferSize);
       this.end = fs.getLength(file);
+      this.conf = conf;
       init();
     }
     
-    private Reader(FileSystem fs, Path file, int bufferSize, long start, long length)
-      throws IOException {
+    private Reader(FileSystem fs, Path file, int bufferSize, long start,
+                   long length, Configuration conf) throws IOException {
       this.fs = fs;
       this.file = file;
       this.in = fs.open(file, bufferSize);
+      this.conf = conf;
       seek(start);
       init();
 
@@ -742,7 +744,7 @@ public class SequenceFile {
             totalCount+= count;
 
             Reader reader = new Reader(fs, inName, memory/(factor+1),
-                                       in.getPos(), length);
+                                       in.getPos(), length, conf);
             reader.sync = null;                   // disable sync on temp files
 
             MergeStream ms = new MergeStream(reader); // add segment to queue
@@ -801,7 +803,7 @@ public class SequenceFile {
         for (int i = 0; i < inFiles.length; i++) {
           Path inFile = inFiles[i];
           MergeStream ms =
-            new MergeStream(new Reader(fs, inFile, memory/(factor+1)));
+            new MergeStream(new Reader(fs, inFile, memory/(factor+1), conf));
           if (ms.next())
             queue.put(ms);
         }