hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amareshw...@apache.org
Subject svn commit: r964752 - in /hadoop/mapreduce/trunk: ./ src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/
Date Fri, 16 Jul 2010 10:59:16 GMT
Author: amareshwari
Date: Fri Jul 16 10:59:16 2010
New Revision: 964752

URL: http://svn.apache.org/viewvc?rev=964752&view=rev
Log:
MAPREDUCE-1621. Fixes NPE in TextOutputReader.getLastOutput if it has never read any output.
Contributed by Amareshwari Sriramadasu

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/RawBytesOutputReader.java
    hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TextOutputReader.java
    hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TypedBytesOutputReader.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=964752&r1=964751&r2=964752&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Fri Jul 16 10:59:16 2010
@@ -170,6 +170,9 @@ Trunk (unreleased changes)
     MAPREDUCE-1865. Rumen should also support jobhistory files generated using
     trunk. (Amar Kamat via amareshwari)
 
+    MAPREDUCE-1621. Fixes NPE in TextOutputReader.getLastOutput if it has never
+    read any output. (amareshwari)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/RawBytesOutputReader.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/RawBytesOutputReader.java?rev=964752&r1=964751&r2=964752&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/RawBytesOutputReader.java
(original)
+++ hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/RawBytesOutputReader.java
Fri Jul 16 10:59:16 2010
@@ -68,7 +68,11 @@ public class RawBytesOutputReader 
 
   @Override
   public String getLastOutput() {
-    return new BytesWritable(bytes).toString();
+    if (bytes != null) {
+      return new BytesWritable(bytes).toString();
+    } else {
+      return null;
+    }
   }
 
   private int readLength() throws IOException {

Modified: hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TextOutputReader.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TextOutputReader.java?rev=964752&r1=964751&r2=964752&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TextOutputReader.java
(original)
+++ hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TextOutputReader.java
Fri Jul 16 10:59:16 2010
@@ -83,10 +83,14 @@ public class TextOutputReader extends Ou
 
   @Override
   public String getLastOutput() {
-    try {
-      return new String(bytes, "UTF-8");
-    } catch (UnsupportedEncodingException e) {
-      return "<undecodable>";
+    if (bytes != null) {
+      try {
+        return new String(bytes, "UTF-8");
+      } catch (UnsupportedEncodingException e) {
+        return "<undecodable>";
+      }
+    } else {
+      return null;
     }
   }
 

Modified: hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TypedBytesOutputReader.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TypedBytesOutputReader.java?rev=964752&r1=964751&r2=964752&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TypedBytesOutputReader.java
(original)
+++ hadoop/mapreduce/trunk/src/contrib/streaming/src/java/org/apache/hadoop/streaming/io/TypedBytesOutputReader.java
Fri Jul 16 10:59:16 2010
@@ -70,7 +70,11 @@ public class TypedBytesOutputReader exte
 
   @Override
   public String getLastOutput() {
-    return new TypedBytesWritable(bytes).toString();
+    if (bytes != null) {
+      return new TypedBytesWritable(bytes).toString();
+    } else {
+      return null;
+    }
   }
 
 }



Mime
View raw message