From 823c2268a26f1b7f97a54add90b63dee5684de95 Mon Sep 17 00:00:00 2001 From: Nikita Konovalov Date: Wed, 18 Oct 2023 17:08:34 +0200 Subject: [PATCH] cleanups: replaced File#delete with Files#delete --- .../main/java/org/apache/camel/test/junit5/TestSupport.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java b/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java index 5d7375f9b9470..01be80cdbfc62 100644 --- a/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java +++ b/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java @@ -485,8 +485,9 @@ public static void recursivelyDeleteDirectory(File file) { recursivelyDeleteDirectory(child); } } - boolean success = file.delete(); - if (!success) { + try { + Files.delete(file.toPath()); + } catch (IOException e) { LOG.warn("Deletion of file: {} failed", file.getAbsolutePath()); } }