Browse Source

MAPREDUCE-3026. Fix NPE in mapred queue -list with hierarchical queues. Contributed by Mayank Bansal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22@1175218 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko 13 years ago
parent
commit
bcf7094c58

+ 3 - 0
mapreduce/CHANGES.txt

@@ -608,6 +608,9 @@ Release 0.22.0 - Unreleased
 
     MAPREDUCE-3025. Contribs not building. (Joep Rottinghuis via shv)
 
+    MAPREDUCE-3026. Fix NPE in mapred queue -list with hierarchical queues.
+    (Mayank Bansal via shv)
+
 Release 0.21.1 - Unreleased
 
   NEW FEATURES

+ 1 - 1
mapreduce/src/java/org/apache/hadoop/mapred/JobQueueInfo.java

@@ -105,7 +105,7 @@ public class JobQueueInfo extends QueueInfo {
   public List<JobQueueInfo> getChildren() {
     List<JobQueueInfo> list = new ArrayList<JobQueueInfo>();
     for (QueueInfo q : super.getQueueChildren()) {
-      list.add((JobQueueInfo)q);
+      list.add(q instanceof JobQueueInfo? (JobQueueInfo)q : new JobQueueInfo(q));
     }
     return list;
   }

+ 3 - 0
mapreduce/src/java/org/apache/hadoop/mapred/JobTracker.java

@@ -4317,6 +4317,9 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
       throws IOException {
     for (JobQueueInfo queue : queues) {
       queue.setJobStatuses(getJobsFromQueue(queue.getQueueName()));
+      for(JobQueueInfo childqueue : queue.getChildren()){
+    	  childqueue.setJobStatuses(getJobsFromQueue(childqueue.getQueueName()));
+      }
     }
     return queues;
   }