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