Claus Ibsen created CAMEL-26079:
-----------------------------------
Summary: camel-aws2 - trace logs of an AWS error can still fail
with a NullPointerException
Key: CAMEL-26079
URL: https://issues.apache.org/jira/browse/CAMEL-26079
Project: Camel
Issue Type: Bug
Components: camel-aws2, camel-aws2-s3
Affects Versions: 4.18.0, 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while reading the AWS components for the catalog body types (CAMEL-24961).
h4. 1. Trace logs of an AWS error can fail with a NullPointerException
{{AwsServiceException.awsErrorDetails()}} can be null, and CAMEL-24262 changed
the catch blocks of the producers to log the error code with
{{AwsExceptionUtil.errorCode(ase)}}. These calls, which span two lines, still
use {{ase.awsErrorDetails().errorCode()}} (main ed3d719b379c):
* {{AWSConfigProducer}}, lines 196, 217 and 287;
* {{Polly2Producer}}, lines 459, 572, 590, 615, 632 and 648;
* {{Rekognition2Producer}}, line 660;
* {{Textract2Producer}}, lines 234, 253 and 346;
* {{Sns2Endpoint}}, line 129.
The arguments of {{LOG.trace}} are evaluated even when trace logging is off, so
an AWS error without details is replaced by a NullPointerException that hides
it. Two more read the status code of the details: {{AWS2S3Consumer}}, line 94,
and {{AWS2S3Endpoint}}, line 163. Read in the code, not run.
*Proposed change*: use {{AwsExceptionUtil.errorCode(ase)}}, and check the
details before reading the status code.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)