DomGarguilo commented on a change in pull request #1965:
URL: https://github.com/apache/accumulo/pull/1965#discussion_r593336903



##########
File path: 
core/src/main/java/org/apache/accumulo/core/util/ratelimit/SharedRateLimiterFactory.java
##########
@@ -112,9 +112,9 @@ protected void update() {
     }
     for (Map.Entry<String,WeakReference<SharedRateLimiter>> entry : 
limitersCopy.entrySet()) {
       try {
-        if (Objects.nonNull(entry.getValue().get())) {
-          entry.getValue().get().update();
-        }
+        Objects.requireNonNull(entry.getValue().get()).update();
+      } catch (NullPointerException npex) {

Review comment:
       These changes were added to avoid spotbugs throwing  a "Possible null 
pointer dereference" error. It seems like adding the extra catch block for NPE 
is redundant and a single catch for `Exception` should be sufficient, however 
without it spotbugs will throw the mentioned error.
   
   I am wondering if it would be best to suppress spotbugs in this case and let 
the singular `Exception` catch block handle the NPE. I am open to suggestions 
on this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to