From 480995096bb2bad3fc4e8f8f304cb705280ab261 Mon Sep 17 00:00:00 2001 From: Aman Sharma Date: Wed, 16 Aug 2023 18:05:09 +0200 Subject: [PATCH] Delete if exists --- watchdog-agent/src/test/java/AgentTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watchdog-agent/src/test/java/AgentTest.java b/watchdog-agent/src/test/java/AgentTest.java index e91b522b..91c25315 100644 --- a/watchdog-agent/src/test/java/AgentTest.java +++ b/watchdog-agent/src/test/java/AgentTest.java @@ -89,14 +89,14 @@ private static void recursiveDeleteOnShutdownHook(final Path path) { @Override public FileVisitResult visitFile(Path file, @SuppressWarnings("unused") BasicFileAttributes attrs) throws IOException { - Files.delete(file); + Files.deleteIfExists(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { - Files.delete(dir); + Files.deleteIfExists(dir); return FileVisitResult.CONTINUE; } // directory iteration failed