Ver Fonte

HADOOP-1740 Fix null pointer exception during map output sorting. Contributed
by Devaraj Das.


git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@570186 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley há 18 anos atrás
pai
commit
cce0b636d1
2 ficheiros alterados com 6 adições e 2 exclusões
  1. 2 0
      CHANGES.txt
  2. 4 2
      src/java/org/apache/hadoop/mapred/MapTask.java

+ 2 - 0
CHANGES.txt

@@ -61,6 +61,8 @@ Trunk (unreleased changes)
     HADOOP-1772.  Fix hadoop-daemon.sh script to get correct hostname
     under Cygwin.  (Tsz Wo (Nicholas), SZE via cutting)
 
+    HADOOP-1740.  Fix null pointer exception in sorting map outputs. (Devaraj
+    Das via omalley)
 
   IMPROVEMENTS
 

+ 4 - 2
src/java/org/apache/hadoop/mapred/MapTask.java

@@ -599,8 +599,10 @@ class MapTask extends Task {
       //check whether the length of the key/value buffer is 0. If not, then
       //we need to spill that to disk. Note that we reset the key/val buffer
       //upon each spill (so a length > 0 means that we have not spilled yet)
-      if (keyValBuffer.getLength() > 0) {
-        sortAndSpillToDisk();
+      synchronized (this) {
+        if (keyValBuffer != null && keyValBuffer.getLength() > 0) {
+          sortAndSpillToDisk();
+        }
       }
       mergeParts();
     }