hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject [34/50] [abbrv] hadoop git commit: YARN-6517. Fix warnings from Spotbugs in hadoop-yarn-common. Contributed by Weiwei Yang
Date Tue, 02 May 2017 21:54:30 GMT
YARN-6517. Fix warnings from Spotbugs in hadoop-yarn-common. Contributed by Weiwei Yang


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

Branch: refs/heads/HDFS-10467
Commit: 18460a16f2274c3d947e267ac6cbf7785c3bb5aa
Parents: 9a17d67
Author: Naganarasimha <naganarasimha_gr@apache.org>
Authored: Mon May 1 16:31:16 2017 +0530
Committer: Inigo <inigoiri@apache.org>
Committed: Tue May 2 14:52:05 2017 -0700

----------------------------------------------------------------------
 .../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/18460a16/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 0aa318c..e5cb255 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
@@ -310,6 +310,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/18460a16/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 d54611e..7f81c5b 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
@@ -481,18 +481,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