You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "Croway (via GitHub)" <gi...@apache.org> on 2026/05/18 14:41:00 UTC

[PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Croway opened a new pull request, #23300:
URL: https://github.com/apache/camel/pull/23300

   ## Summary
   
   _Claude Code on behalf of Federico Mariani_
   
   - **LogProcessor**: guard against null message before calling `doLog()` — prevents NPE after CAMEL-22640 added `Objects.requireNonNull` to `CamelLogger`. When a Simple expression like `${body}` evaluates to null (e.g., `ignoreBody=true` on the S3 consumer), the log EIP crashed with `NullPointerException: message`.
   - **AWS2S3Consumer**: use `Optional.ofNullable` instead of `Optional.of` in `includeS3Object()` to handle null `contentType` when `includeFolders` is `false`. Latent bug — currently dormant because `includeFolders` defaults to `true`.
   - **KinesisResumeStrategyConfiguration**: skip `setResumeCache` when cache is null to avoid passing null downstream.
   
   ## Test plan
   
   - [x] `S3ConsumerIgnoreBodyIT` — was consistently timing out, now passes
   - [x] `S3ConsumerIT` — no regression
   - [x] `S3ConsumerIncludeBodyIT` — no regression


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #23300:
URL: https://github.com/apache/camel/pull/23300#discussion_r3259877992


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisResumeStrategyConfiguration.java:
##########
@@ -60,7 +60,9 @@ public KinesisResumeStrategyConfigurationBuilder withResumeCache(ResumeCache<?>
         @Override
         public KinesisResumeStrategyConfiguration build() {
             KinesisResumeStrategyConfiguration result = new KinesisResumeStrategyConfiguration();
-            result.setResumeCache(resumeCache);
+            if (resumeCache != null) {
+                result.setResumeCache(resumeCache);
+            }

Review Comment:
   created https://github.com/apache/camel/pull/23302



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix latent NPE in S3 consumer includeS3Object with null contentType [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23300:
URL: https://github.com/apache/camel/pull/23300#issuecomment-4480212502

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-aws/camel-aws2-s3`
   
   <details><summary>All tested modules (9 modules)</summary>
   
   - Camel :: AWS2 Eventbridge
   - Camel :: AWS2 S3
   - Camel :: JBang :: MCP
   - Camel :: JBang :: Plugin :: Route Parser
   - Camel :: JBang :: Plugin :: TUI
   - Camel :: JBang :: Plugin :: Validate
   - Camel :: Launcher :: Container
   - Camel :: YAML DSL :: Validator
   - Camel :: YAML DSL :: Validator Maven Plugin
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/26041880325)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #23300:
URL: https://github.com/apache/camel/pull/23300#discussion_r3259821906


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisResumeStrategyConfiguration.java:
##########
@@ -60,7 +60,9 @@ public KinesisResumeStrategyConfigurationBuilder withResumeCache(ResumeCache<?>
         @Override
         public KinesisResumeStrategyConfiguration build() {
             KinesisResumeStrategyConfiguration result = new KinesisResumeStrategyConfiguration();
-            result.setResumeCache(resumeCache);
+            if (resumeCache != null) {
+                result.setResumeCache(resumeCache);
+            }

Review Comment:
   I think it would be better that the ResumeStartegyConfiguration.setResumeCache accepts null, as it was before.
   Currently, we removed the possibility to set back resumecache to a null value



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix latent NPE in S3 consumer includeS3Object with null contentType [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #23300:
URL: https://github.com/apache/camel/pull/23300


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #23300:
URL: https://github.com/apache/camel/pull/23300#discussion_r3259803637


##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/LogProcessor.java:
##########
@@ -77,7 +77,9 @@ public boolean process(Exchange exchange, AsyncCallback callback) {
                 if (listeners != null && !listeners.isEmpty()) {
                     msg = fireListeners(exchange, msg);
                 }
-                logger.doLog(msg);
+                if (msg != null) {
+                    logger.doLog(msg);

Review Comment:
   this is changing the initial behaviour. Instead of loggign one line with no content apart from the time/loggername information, there won't be any more log which will be silently ignored.
   
   I proposed https://github.com/apache/camel/pull/23299



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix latent NPE in S3 consumer includeS3Object with null contentType [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23300:
URL: https://github.com/apache/camel/pull/23300#issuecomment-4479722136

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix latent NPE in S3 consumer includeS3Object with null contentType [camel]

Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #23300:
URL: https://github.com/apache/camel/pull/23300#issuecomment-4486907333

   rebased


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #23300:
URL: https://github.com/apache/camel/pull/23300#discussion_r3259883709


##########
components/camel-aws/camel-aws2-kinesis/src/main/java/org/apache/camel/component/aws2/kinesis/consumer/KinesisResumeStrategyConfiguration.java:
##########
@@ -60,7 +60,9 @@ public KinesisResumeStrategyConfigurationBuilder withResumeCache(ResumeCache<?>
         @Override
         public KinesisResumeStrategyConfiguration build() {
             KinesisResumeStrategyConfiguration result = new KinesisResumeStrategyConfiguration();
-            result.setResumeCache(resumeCache);
+            if (resumeCache != null) {
+                result.setResumeCache(resumeCache);
+            }

Review Comment:
   and when reading code, it is even making less sense to forbid to provide a null value as the attribute in the class is marked as @Nullable



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix latent NPE in S3 consumer includeS3Object with null contentType [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #23300:
URL: https://github.com/apache/camel/pull/23300#issuecomment-4486636150

   I guess this PR is outdated and not needed as the 2 PRs from @apupier resolves this


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on PR #23300:
URL: https://github.com/apache/camel/pull/23300#issuecomment-4478876378

   relates to regression introduced by https://github.com/apache/camel/pull/23021


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: fix null safety in LogProcessor, S3 consumer, and Kinesis resume config [camel]

Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #23300:
URL: https://github.com/apache/camel/pull/23300#issuecomment-4478949737

   good point @apupier , it is not the first time that I need to `if(.. != null) { ..set... }`, and I am not proud of, if it can be handled by reverting some changes, that's better


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org