Federico Mariani created CAMEL-27080:
----------------------------------------
Summary: camel-smb - a starting directory the server refuses to
create fails the route start
Key: CAMEL-27080
URL: https://issues.apache.org/jira/browse/CAMEL-27080
Project: Camel
Issue Type: Bug
Components: camel-smb
Reporter: Federico Mariani
When the smb consumer cannot create its starting directory when the route
starts ({{autoCreate=true}}, the default) because the server refuses it, such
as {{STATUS_ACCESS_DENIED}} on a read-only share, the route fails to start.
{{SmbConsumer.doStart}} is meant to log a WARN and start the consumer in that
case, and each poll then tries to create the directory again (CAMEL-22177, see
the 4.13 upgrade guide). But it only catches
{{GenericFileOperationFailedException}}, and {{SmbOperations.buildDirectory}}
rethrows the smbj {{SMBRuntimeException}} as it is. A failure to connect is
wrapped, so the route does start when the server cannot be reached. The ftp and
sftp operations wrap the error of their client in a
{{GenericFileOperationFailedException}} too. This happens since CAMEL-22235
(4.10.7, 4.14.0), which made {{buildDirectory}} rethrow the errors it ignored
before.
{code:java}
// the user is not allowed to create the directory inbox in the share
from("smb:host/share/inbox?username=camel&password=secret")
.to("log:in");
// FailedToStartRouteException: Failed to start route: route1 because:
STATUS_ACCESS_DENIED (0xc0000022): Create failed for \\host\share\inbox
{code}
Expected: the route starts and logs {{Error auto creating directory: inbox due
STATUS_ACCESS_DENIED (0xc0000022): Create failed for \\host\share\inbox. This
exception is ignored.}}, and each poll tries to create the directory again,
with the WARN of CAMEL-27078 logged once.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)