This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new efbad7ca7dbc chore: fix latent NPE in S3 consumer includeS3Object with
null contentType (#23300)
efbad7ca7dbc is described below
commit efbad7ca7dbcc8d871a37f3dbf5fdda44c6e8adb
Author: Federico Mariani <[email protected]>
AuthorDate: Tue May 19 20:57:03 2026 +0200
chore: fix latent NPE in S3 consumer includeS3Object with null contentType
(#23300)
* chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume
config
- LogProcessor: guard against null message before calling doLog() to
prevent NPE after CAMEL-22640 added requireNonNull to CamelLogger
- AWS2S3Consumer: use Optional.ofNullable in includeS3Object() to
handle null contentType when includeFolders is false
- KinesisResumeStrategyConfiguration: skip setResumeCache when cache
is null
* chore: keep only the S3 Optional.ofNullable fix
Remove LogProcessor and KinesisResumeStrategyConfiguration changes
as those are better addressed at the source by #23299 and #23302.
---
.../main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
index e29563f4dd81..132d50e4875a 100644
---
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
+++
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
@@ -284,7 +284,7 @@ public class AWS2S3Consumer extends
ScheduledBatchPollingConsumer {
return true;
} else {
// Config says to ignore folders/directories
- return !Optional.of(s3Object.response().contentType()).orElse("")
+ return
!Optional.ofNullable(s3Object.response().contentType()).orElse("")
.toLowerCase().startsWith("application/x-directory");
}
}