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

This commit is contained in:
Naganarasimha 2017-06-18 19:53:42 +05:30
parent 6460df21a0
commit 7582dedad1

View File

@ -310,12 +310,17 @@ public String getUser() {
}
private Set<File> getPendingLogFilesToUpload(File containerLogDir) {
if(containerLogDir == null ||
containerLogDir.listFiles() == null) {
if(containerLogDir == null) {
return new HashSet<>(0);
}
File[] filesList = containerLogDir.listFiles();
if (filesList == null) {
return new HashSet<>(0);
}
Set<File> candidates =
new HashSet<File>(Arrays.asList(containerLogDir.listFiles()));
new HashSet<File>(Arrays.asList(filesList));
for (File logFile : candidates) {
this.allExistingFileMeta.add(getLogFileMetaData(logFile));
}