Repository: hadoop
Updated Branches:
  refs/heads/branch-2 e09222306 -> 5923f5079


MAPREDUCE-6554. MRAppMaster servicestart failing with NPE in 
MRAppMaster#parsePreviousJobHistory. Contributed by Bibin A Chundatt
(cherry picked from commit 9fbd579ab50f051c8ad63d316ca5a3e24822dcdd)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5923f507
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5923f507
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5923f507

Branch: refs/heads/branch-2
Commit: 5923f50797f72a1b536af4a1d98b4f7c9e2e41de
Parents: e092223
Author: Jason Lowe <jl...@apache.org>
Authored: Fri Jan 15 16:52:53 2016 +0000
Committer: Jason Lowe <jl...@apache.org>
Committed: Fri Jan 15 16:53:34 2016 +0000

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  6 +++
 .../mapreduce/jobhistory/EventReader.java       | 39 ++++++++++++--------
 2 files changed, 30 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/5923f507/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt 
b/hadoop-mapreduce-project/CHANGES.txt
index 3fbb119..6471131 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -420,6 +420,9 @@ Release 2.7.3 - UNRELEASED
     MAPREDUCE-6583. Clarify confusing sentence in MapReduce tutorial document.
     (Kai Sasaki via aajisaka)
 
+    MAPREDUCE-6554. MRAppMaster servicestart failing with NPE in
+    MRAppMaster#parsePreviousJobHistory (Bibin A Chundatt via jlowe)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES
@@ -719,6 +722,9 @@ Release 2.6.4 - UNRELEASED
     MAPREDUCE-6363. [NNBench] Lease mismatch error when running with multiple
     mappers. (Vlad Sharanhovich and Bibin A Chundatt via aajisaka)
 
+    MAPREDUCE-6554. MRAppMaster servicestart failing with NPE in
+    MRAppMaster#parsePreviousJobHistory (Bibin A Chundatt via jlowe)
+
 Release 2.6.3 - 2015-12-17
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5923f507/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/EventReader.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/EventReader.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/EventReader.java
index 9898c2d..3c7055c 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/EventReader.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/EventReader.java
@@ -20,9 +20,16 @@ package org.apache.hadoop.mapreduce.jobhistory;
 
 import java.io.Closeable;
 import java.io.DataInputStream;
-import java.io.IOException;
 import java.io.EOFException;
+import java.io.IOException;
 
+import org.apache.avro.AvroRuntimeException;
+import org.apache.avro.Schema;
+import org.apache.avro.io.DatumReader;
+import org.apache.avro.io.Decoder;
+import org.apache.avro.io.DecoderFactory;
+import org.apache.avro.specific.SpecificData;
+import org.apache.avro.specific.SpecificDatumReader;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.fs.FileSystem;
@@ -31,13 +38,6 @@ import org.apache.hadoop.mapreduce.CounterGroup;
 import org.apache.hadoop.mapreduce.Counters;
 import org.apache.hadoop.util.StringInterner;
 
-import org.apache.avro.Schema;
-import org.apache.avro.io.Decoder;
-import org.apache.avro.io.DecoderFactory;
-import org.apache.avro.io.DatumReader;
-import org.apache.avro.specific.SpecificData;
-import org.apache.avro.specific.SpecificDatumReader;
-
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public class EventReader implements Closeable {
@@ -69,14 +69,23 @@ public class EventReader implements Closeable {
 
     Schema myschema = new 
SpecificData(Event.class.getClassLoader()).getSchema(Event.class);
     Schema.Parser parser = new Schema.Parser();
-    this.schema = parser.parse(in.readLine());
-    this.reader = new SpecificDatumReader(schema, myschema);
-    if (EventWriter.VERSION.equals(version)) {
-      this.decoder = DecoderFactory.get().jsonDecoder(schema, in);
-    } else if (EventWriter.VERSION_BINARY.equals(version)) {
-      this.decoder = DecoderFactory.get().binaryDecoder(in, null);
+    String eventschema = in.readLine();
+    if (null != eventschema) {
+      try {
+        this.schema = parser.parse(eventschema);
+        this.reader = new SpecificDatumReader(schema, myschema);
+        if (EventWriter.VERSION.equals(version)) {
+          this.decoder = DecoderFactory.get().jsonDecoder(schema, in);
+        } else if (EventWriter.VERSION_BINARY.equals(version)) {
+          this.decoder = DecoderFactory.get().binaryDecoder(in, null);
+        } else {
+          throw new IOException("Incompatible event log version: " + version);
+        }
+      } catch (AvroRuntimeException e) {
+        throw new IOException(e);
+      }
     } else {
-      throw new IOException("Incompatible event log version: " + version);
+      throw new IOException("Event schema string not parsed since its null");
     }
   }
   

Reply via email to