You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/01/18 14:16:49 UTC

(camel) 03/06: CAMEL-20297 camel-util: do not swallow interrupted exceptions

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8fd7c5a8eb92a720570422ec1eb23056cf1da7f8
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Jan 16 11:01:53 2024 +0100

    CAMEL-20297 camel-util: do not swallow interrupted exceptions
---
 .../camel-util/src/main/java/org/apache/camel/util/FileUtil.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java b/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
index 5f06399f077..22e9b732a95 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/FileUtil.java
@@ -385,7 +385,8 @@ public final class FileUtil {
             try {
                 Thread.sleep(RETRY_SLEEP_MILLIS);
             } catch (InterruptedException ex) {
-                // Ignore Exception
+                LOG.info("Interrupted while trying to delete file {}", f, e);
+                Thread.currentThread().interrupt();
             }
             try {
                 Files.delete(f.toPath());
@@ -424,7 +425,8 @@ public final class FileUtil {
                 try {
                     Thread.sleep(1000);
                 } catch (InterruptedException e) {
-                    // ignore
+                    LOG.info("Interrupted while trying to rename file from {} to {}", from, to, e);
+                    Thread.currentThread().interrupt();
                 }
             }
             count++;
@@ -511,7 +513,8 @@ public final class FileUtil {
                     try {
                         Thread.sleep(1000);
                     } catch (InterruptedException ie) {
-                        // ignore
+                        LOG.info("Interrupted while trying to delete file {}", file, e);
+                        Thread.currentThread().interrupt();
                     }
                 }
             }