mosermw commented on code in PR #7664:
URL: https://github.com/apache/nifi/pull/7664#discussion_r1316383800


##########
nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/monitor/SynchronousFileWatcher.java:
##########
@@ -77,21 +77,16 @@ public boolean checkAndReset() throws IOException {
     private boolean checkForUpdate() throws IOException {
         if (resourceLock.tryLock()) {
             try {
-                final StateWrapper wrapper = lastState.get();
+                final Object oldState = lastState.get().getState();
                 final Object newState = monitor.getCurrentState(path);
-                if (newState == null && wrapper.getState() == null) {
+                if (newState == null && oldState == null) {
                     return false;
                 }
-                if (newState == null || wrapper.getState() == null) {
-                    lastState.set(new StateWrapper(newState));
+                lastState.set(new StateWrapper(newState));

Review Comment:
   I don't think so?  StateWrapper is a simple pojo with getters/setters and no 
real logic, so I don't think it cares.  This method handles checking for nulls 
on newState and oldState, so I was happy that NPE wasn't possible.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to