From dfc492d285ef31f7ad7cb1042274e2c5116cf28f Mon Sep 17 00:00:00 2001 From: Maurizio Turatti Date: Thu, 21 Nov 2024 16:21:10 +0100 Subject: [PATCH] :art: Clean up import statements and improve code formatting in DirectoryWatcher --- .../org/restheart/utils/DirectoryWatcher.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/commons/src/main/java/org/restheart/utils/DirectoryWatcher.java b/commons/src/main/java/org/restheart/utils/DirectoryWatcher.java index 3dd29b053..e6883e56e 100644 --- a/commons/src/main/java/org/restheart/utils/DirectoryWatcher.java +++ b/commons/src/main/java/org/restheart/utils/DirectoryWatcher.java @@ -20,13 +20,14 @@ */ package org.restheart.utils; +import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; +import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; +import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; + import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; -import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; -import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; -import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; import java.nio.file.WatchEvent; import java.nio.file.WatchEvent.Kind; import java.nio.file.WatchKey; @@ -82,7 +83,7 @@ public void run() { WatchKey key; try { - key = watchService.take(); // This will block until an event occurs + key = watchService.take(); // This will block until an event occurs } catch (InterruptedException e) { return; } @@ -112,10 +113,10 @@ public void run() { LambdaUtils.throwsSneakyException(e); } this.onEvent.accept(child, ENTRY_CREATE); - } else if (kind.equals(ENTRY_MODIFY) && Files.isRegularFile(child)) { + } else if (kind.equals(ENTRY_MODIFY) && Files.isRegularFile(child)) { LOGGER.debug("File modified: {}", child); this.onEvent.accept(child, ENTRY_MODIFY); - } else if (kind.equals(ENTRY_DELETE)) { + } else if (kind.equals(ENTRY_DELETE)) { LOGGER.debug("File or directory deleted: {}", child); this.onEvent.accept(child, ENTRY_DELETE); @@ -144,4 +145,4 @@ public void run() { } } } -} +} \ No newline at end of file