From 60a8e7c683ac7737be75c063e24fe99a1968cde3 Mon Sep 17 00:00:00 2001 From: CZuegner Date: Fri, 9 Sep 2022 09:23:45 +0200 Subject: [PATCH] Windows does not throw FileNotFoundException Windows Environment throws FileSystemException when the file is blocked by another process --- .../strategy/GenericFileRenameExclusiveReadLockStrategy.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java index 922eb659e443d..2a130fc39248a 100644 --- a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java +++ b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameExclusiveReadLockStrategy.java @@ -17,6 +17,7 @@ package org.apache.camel.component.file.strategy; import java.io.FileNotFoundException; +import java.nio.file.FileSystemException; import org.apache.camel.Exchange; import org.apache.camel.LoggingLevel; @@ -79,7 +80,7 @@ public boolean acquireExclusiveReadLock(GenericFileOperations operations, Gen try { exclusive = operations.renameFile(file.getAbsoluteFilePath(), newFile.getAbsoluteFilePath()); } catch (GenericFileOperationFailedException ex) { - if (ex.getCause() instanceof FileNotFoundException) { + if (ex.getCause() instanceof FileNotFoundException || ex.getCause() instanceof FileSystemException) { exclusive = false; } else { throw ex;