瀏覽代碼

HADOOP-695. Fix a NullPointerException in contrib/streaming.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@475393 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 年之前
父節點
當前提交
14f6cab132

+ 3 - 0
CHANGES.txt

@@ -85,6 +85,9 @@ Trunk (unreleased changes)
     to be smaller than the buffer size, typically only when debugging.
     to be smaller than the buffer size, typically only when debugging.
     (Milind Bhandarkar via cutting)
     (Milind Bhandarkar via cutting)
 
 
+26. HADOOP-695.  Fix a NullPointerException in contrib/streaming.
+    (Hairong Kuang via cutting)
+
 
 
 Release 0.8.0 - 2006-11-03
 Release 0.8.0 - 2006-11-03
 
 

+ 1 - 1
src/contrib/streaming/src/java/org/apache/hadoop/streaming/StreamLineRecordReader.java

@@ -97,13 +97,13 @@ public class StreamLineRecordReader extends StreamBaseRecordReader {
       }
       }
 
 
       line = UTF8ByteArrayUtils.readLine((InputStream) in_);
       line = UTF8ByteArrayUtils.readLine((InputStream) in_);
+      if (line == null) return false;
       try {
       try {
         Text.validateUTF8(line);
         Text.validateUTF8(line);
       } catch (MalformedInputException m) {
       } catch (MalformedInputException m) {
         System.err.println("line=" + line + "|" + new Text(line));
         System.err.println("line=" + line + "|" + new Text(line));
         System.out.flush();
         System.out.flush();
       }
       }
-      if (line == null) return false;
       try {
       try {
         int tab = UTF8ByteArrayUtils.findTab(line);
         int tab = UTF8ByteArrayUtils.findTab(line);
         if (tab == -1) {
         if (tab == -1) {