YARN-6517. Fix warnings from Spotbugs in hadoop-yarn-common. Contributed by Weiwei Yang
(cherry picked from commit 4b5bd73ac5
)
This commit is contained in:
parent
9b8940366e
commit
29370e7784
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue