Browse Source

HADOOP-1892. Fix a NullPointerException in the JobTracker when trying to fetch a task's diagnostic messages from the JobClient.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@575889 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 17 năm trước cách đây
mục cha
commit
b58932a010
2 tập tin đã thay đổi với 11 bổ sung4 xóa
  1. 4 0
      CHANGES.txt
  2. 7 4
      src/java/org/apache/hadoop/mapred/JobTracker.java

+ 4 - 0
CHANGES.txt

@@ -140,6 +140,10 @@ Trunk (unreleased changes)
     HADOOP-1889.  Fix path in EC2 scripts for building your own AMI.
     (tomwhite)
 
+    HADOOP-1892.  Fix a NullPointerException in the JobTracker when
+    trying to fetch a task's diagnostic messages from the JobClient.
+    (Amar Kamat via acmurthy)
+
   IMPROVEMENTS
 
     HADOOP-1266. Remove dependency of package org.apache.hadoop.net on 

+ 7 - 4
src/java/org/apache/hadoop/mapred/JobTracker.java

@@ -1653,9 +1653,10 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
    * @param taskId the id of the task
    * @return an array of the diagnostic messages
    */
-  public synchronized String[] getTaskDiagnostics(String jobId,
-                                                      String tipId,
-                                                      String taskId) throws IOException {
+  public synchronized String[] getTaskDiagnostics(String jobId, 
+                                                  String tipId, 
+                                                  String taskId) 
+  throws IOException {
     JobInProgress job = jobs.get(jobId);
     if (job == null) {
       throw new IllegalArgumentException("Job " + jobId + " not found.");
@@ -1664,7 +1665,9 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
     if (tip == null) {
       throw new IllegalArgumentException("TIP " + tipId + " not found.");
     }
-    return tip.getDiagnosticInfo(taskId).toArray(new String[0]);
+    List<String> taskDiagnosticInfo = tip.getDiagnosticInfo(taskId);
+    return ((taskDiagnosticInfo == null) ? null 
+            : taskDiagnosticInfo.toArray(new String[0]));
   }
     
   /** Get all the TaskStatuses from the tipid. */