Browse Source

YARN-11754. [JDK17] Fix SpotBugs Issues in YARN. (#7317) Contributed by Shilun Fan.

Reviewed-by: Chris Nauroth <cnauroth@apache.org>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
slfan1989 5 months ago
parent
commit
1ba30d6ca6

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java

@@ -343,7 +343,7 @@ public class ResourceLocalizationService extends CompositeService
       LocalResourceTrackerState state) throws URISyntaxException, IOException {
     try (RecoveryIterator<LocalizedResourceProto> it =
              state.getCompletedResourcesIterator()) {
-      while (it != null && it.hasNext()) {
+      while (it.hasNext()) {
         LocalizedResourceProto proto = it.next();
         LocalResource rsrc = new LocalResourcePBImpl(proto.getResource());
         LocalResourceRequest req = new LocalResourceRequest(rsrc);
@@ -356,7 +356,7 @@ public class ResourceLocalizationService extends CompositeService
 
     try (RecoveryIterator<Map.Entry<LocalResourceProto, Path>> it =
              state.getStartedResourcesIterator()) {
-      while (it != null && it.hasNext()) {
+      while (it.hasNext()) {
         Map.Entry<LocalResourceProto, Path> entry = it.next();
         LocalResource rsrc = new LocalResourcePBImpl(entry.getKey());
         LocalResourceRequest req = new LocalResourceRequest(rsrc);

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnRWHelper.java

@@ -330,7 +330,7 @@ public final class ColumnRWHelper {
               for (Map.Entry<Long, byte[]> cell : cells.entrySet()) {
                 V value =
                     (V) valueConverter.decodeValue(cell.getValue());
-                Long ts = supplementTs ? TimestampGenerator.
+                long ts = supplementTs ? TimestampGenerator.
                     getTruncatedTimestamp(cell.getKey()) : cell.getKey();
                 cellResults.put(ts, value);
               }