hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From naganarasimha...@apache.org
Subject hadoop git commit: YARN-6517. Fix warnings from Spotbugs in hadoop-yarn-common. Contributed by Weiwei Yang
Date Mon, 01 May 2017 11:08:24 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 9b8940366 -> 29370e778


YARN-6517. Fix warnings from Spotbugs in hadoop-yarn-common. Contributed by Weiwei Yang

(cherry picked from commit 4b5bd73ac53f7de4899b5b70078249ad20216048)


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

Branch: refs/heads/branch-2
Commit: 29370e7784a8f18c978cf466a4e90646e7c8cbc0
Parents: 9b89403
Author: Naganarasimha <naganarasimha_gr@apache.org>
Authored: Mon May 1 16:31:16 2017 +0530
Committer: Naganarasimha <naganarasimha_gr@apache.org>
Committed: Mon May 1 16:35:45 2017 +0530

----------------------------------------------------------------------
 .../logaggregation/AggregatedLogFormat.java     |  4 ++++
 .../yarn/util/ProcfsBasedProcessTree.java       | 23 +++++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/29370e77/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
index a2e1243..30a4728 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/AggregatedLogFormat.java
@@ -308,6 +308,10 @@ public class AggregatedLogFormat {
     }
 
     private Set<File> getPendingLogFilesToUpload(File containerLogDir) {
+      if(containerLogDir == null ||
+          containerLogDir.listFiles() == null) {
+        return new HashSet<>(0);
+      }
       Set<File> candidates =
           new HashSet<File>(Arrays.asList(containerLogDir.listFiles()));
       for (File logFile : candidates) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/29370e77/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
index e581af5..c761aea 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ProcfsBasedProcessTree.java
@@ -493,18 +493,21 @@ public class ProcfsBasedProcessTree extends ResourceCalculatorProcessTree
{
    * Get the list of all processes in the system.
    */
   private List<String> getProcessList() {
-    String[] processDirs = (new File(procfsDir)).list();
     List<String> processList = new ArrayList<String>();
-
-    for (String dir : processDirs) {
-      Matcher m = numberPattern.matcher(dir);
-      if (!m.matches()) continue;
-      try {
-        if ((new File(procfsDir, dir)).isDirectory()) {
-          processList.add(dir);
+    String[] processDirs = (new File(procfsDir)).list();
+    if (processDirs != null) {
+      for (String dir : processDirs) {
+        Matcher m = numberPattern.matcher(dir);
+        if (!m.matches()) {
+          continue;
+        }
+        try {
+          if ((new File(procfsDir, dir)).isDirectory()) {
+            processList.add(dir);
+          }
+        } catch (SecurityException s) {
+          // skip this process
         }
-      } catch (SecurityException s) {
-        // skip this process
       }
     }
     return processList;


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message