Federico Mariani created CAMEL-27104:
----------------------------------------

             Summary: camel-azure-files - a starting directory the share 
refuses to create, or a refused connection, fails the route start
                 Key: CAMEL-27104
                 URL: https://issues.apache.org/jira/browse/CAMEL-27104
             Project: Camel
          Issue Type: Bug
          Components: camel-azure
            Reporter: Federico Mariani


When the azure-files consumer cannot create its starting directory as the route 
starts ({{autoCreate=true}}, the default) because the share refuses it, such as 
{{403 AuthorizationPermissionMismatch}} for an identity that may read but not 
create directories, the route fails to start. The same happens when the share 
refuses the connection, such as {{403 AuthenticationFailed}} for a wrong or 
expired key.

{{FilesConsumer.doStart}} is meant to log a WARN and start the consumer in 
these cases, and each poll then tries again (CAMEL-22177, see the 4.13 upgrade 
guide). But it only catches {{GenericFileOperationFailedException}}, and 
{{FilesOperations.connect}} and {{FilesOperations.buildDirectory}} let the 
{{ShareStorageException}} of the Azure SDK through as it is. The ftp, sftp and 
smb consumers start in both cases: their operations wrap the error of their 
client in a {{GenericFileOperationFailedException}} (smb for a refused 
directory since CAMEL-27080).

{code:java}
// the identity may read the share but not create the directory inbox
from("azure-files://account/share/inbox?credentialType=AZURE_IDENTITY")
    .to("log:in");
// FailedToStartRouteException: Failed to start route: route1 because: Status 
code 403, "...AuthorizationPermissionMismatch..."
{code}

Expected: the route starts and logs {{Error auto creating directory: /inbox due 
to Status code 403, ... This exception is ignored.}}, each poll connects and 
tries to create the directory again (logging {{Cannot auto-create starting 
directory /inbox at: ... Will skip this poll.}} or {{Cannot connect/login to: 
... Will skip this poll.}} once), and the consumer polls the directory once it 
exists. {{connect}} and {{buildDirectory}} throw a 
{{GenericFileOperationFailedException}} with the {{ShareStorageException}} as 
its cause, so {{onException(ShareStorageException.class)}} still matches.

_Claude Code on behalf of Federico Mariani_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to