mosermw commented on code in PR #7664: URL: https://github.com/apache/nifi/pull/7664#discussion_r1317258043
########## 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: We don't know what UpdateMonitor implementation is currently in use, and that interface doesn't guarantee that `monitor.getCurrentState(path)` returns NotNull. So we have to check for nulls before using `newState.equals()` on line 89. -- 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: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org