YARN-6517. Fix warnings from Spotbugs in hadoop-yarn-common. Contributed by Weiwei Yang
This commit is contained in:
parent
f378621546
commit
4b5bd73ac5
@ -310,6 +310,10 @@ public String getUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<File> getPendingLogFilesToUpload(File containerLogDir) {
|
private Set<File> getPendingLogFilesToUpload(File containerLogDir) {
|
||||||
|
if(containerLogDir == null ||
|
||||||
|
containerLogDir.listFiles() == null) {
|
||||||
|
return new HashSet<>(0);
|
||||||
|
}
|
||||||
Set<File> candidates =
|
Set<File> candidates =
|
||||||
new HashSet<File>(Arrays.asList(containerLogDir.listFiles()));
|
new HashSet<File>(Arrays.asList(containerLogDir.listFiles()));
|
||||||
for (File logFile : candidates) {
|
for (File logFile : candidates) {
|
||||||
|
@ -481,18 +481,21 @@ private static String getValidPID(String pid) {
|
|||||||
* Get the list of all processes in the system.
|
* Get the list of all processes in the system.
|
||||||
*/
|
*/
|
||||||
private List<String> getProcessList() {
|
private List<String> getProcessList() {
|
||||||
String[] processDirs = (new File(procfsDir)).list();
|
|
||||||
List<String> processList = new ArrayList<String>();
|
List<String> processList = new ArrayList<String>();
|
||||||
|
String[] processDirs = (new File(procfsDir)).list();
|
||||||
for (String dir : processDirs) {
|
if (processDirs != null) {
|
||||||
Matcher m = numberPattern.matcher(dir);
|
for (String dir : processDirs) {
|
||||||
if (!m.matches()) continue;
|
Matcher m = numberPattern.matcher(dir);
|
||||||
try {
|
if (!m.matches()) {
|
||||||
if ((new File(procfsDir, dir)).isDirectory()) {
|
continue;
|
||||||
processList.add(dir);
|
}
|
||||||
|
try {
|
||||||
|
if ((new File(procfsDir, dir)).isDirectory()) {
|
||||||
|
processList.add(dir);
|
||||||
|
}
|
||||||
|
} catch (SecurityException s) {
|
||||||
|
// skip this process
|
||||||
}
|
}
|
||||||
} catch (SecurityException s) {
|
|
||||||
// skip this process
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return processList;
|
return processList;
|
||||||
|
Loading…
Reference in New Issue
Block a user