YARN-6518. Fix warnings from Spotbugs in hadoop-yarn-server-timelineservice. Contributed by Weiwei Yang.
This commit is contained in:
parent
4b5bd73ac5
commit
0f1af3178e
|
@ -278,21 +278,24 @@ public class FileSystemTimelineReaderImpl extends AbstractService
|
|||
}
|
||||
}
|
||||
);
|
||||
for (File entityFile : dir.listFiles()) {
|
||||
if (!entityFile.getName().contains(TIMELINE_SERVICE_STORAGE_EXTENSION)) {
|
||||
if (dir != null) {
|
||||
File[] files = dir.listFiles();
|
||||
if (files != null) {
|
||||
for (File entityFile : files) {
|
||||
if (!entityFile.getName()
|
||||
.contains(TIMELINE_SERVICE_STORAGE_EXTENSION)) {
|
||||
continue;
|
||||
}
|
||||
try (BufferedReader reader =
|
||||
new BufferedReader(
|
||||
new InputStreamReader(
|
||||
new FileInputStream(
|
||||
entityFile), Charset.forName("UTF-8")))) {
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(new FileInputStream(entityFile),
|
||||
Charset.forName("UTF-8")))) {
|
||||
TimelineEntity entity = readEntityFromFile(reader);
|
||||
if (!entity.getType().equals(entityType)) {
|
||||
continue;
|
||||
}
|
||||
if (!isTimeInRange(entity.getCreatedTime(),
|
||||
filters.getCreatedTimeBegin(), filters.getCreatedTimeEnd())) {
|
||||
filters.getCreatedTimeBegin(),
|
||||
filters.getCreatedTimeEnd())) {
|
||||
continue;
|
||||
}
|
||||
if (filters.getRelatesTo() != null &&
|
||||
|
@ -339,8 +342,10 @@ public class FileSystemTimelineReaderImpl extends AbstractService
|
|||
entitiesCreatedAtSameTime = new HashSet<TimelineEntity>();
|
||||
}
|
||||
entitiesCreatedAtSameTime.add(entityToBeReturned);
|
||||
sortedEntities.put(
|
||||
entityToBeReturned.getCreatedTime(), entitiesCreatedAtSameTime);
|
||||
sortedEntities.put(entityToBeReturned.getCreatedTime(),
|
||||
entitiesCreatedAtSameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue