CAMEL-23271: Fix SonarCloud blocker reliability issues (resource leaks)#22343
Open
gnodet wants to merge 5 commits intoapache:mainfrom
Open
CAMEL-23271: Fix SonarCloud blocker reliability issues (resource leaks)#22343gnodet wants to merge 5 commits intoapache:mainfrom
gnodet wants to merge 5 commits intoapache:mainfrom
Conversation
- JcrConsumer: store ScheduledExecutorService in a field and shut it down in doStop() - ModelWriterGeneratorMojo: wrap DynamicClassLoader in try-with-resources - Set sonar.java.source=17 to eliminate 23 HttpClient false positives - Add @SuppressWarnings for ExecutorService/CamelContext lifecycle false positives Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8aae561 to
749676c
Compare
Croway
reviewed
Mar 30, 2026
Address review feedback: use the existing jdk.version property instead of hardcoding '17', consistent with other compiler settings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
apupier
reviewed
Mar 30, 2026
components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
Show resolved
Hide resolved
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
squakez
reviewed
Mar 30, 2026
...force-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
Outdated
Show resolved
Hide resolved
- Move sonar.java.source above the NOTE comment so it stays with sonar.coverage.jacoco.xmlReportPaths (apupier) - Replace method-level @SuppressWarnings with line-level // NOSONAR to avoid masking future real leaks (squakez) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Narrow suppression scope: move @SuppressWarnings("java:S2095") from method level to the local variable declarations where the resources are created, so it won't mask future issues in the same methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CamelContext implements AutoCloseable, so use try-with-resources instead of manual stop in finally block. Removes the need for @SuppressWarnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
/component-test jcr salesforce |
apupier
approved these changes
Mar 31, 2026
| <!-- reproducible builds: https://maven.apache.org/guides/mini/guide-reproducible-builds.html --> | ||
| <project.build.outputTimestamp>2026-02-17T16:11:10Z</project.build.outputTimestamp> | ||
|
|
||
| <!-- Tell SonarCloud which Java source level to use for analysis --> |
Contributor
There was a problem hiding this comment.
i think this comment is very redundant and does not add value (not a blocker)
Contributor
|
✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix all 31 SonarCloud blocker reliability issues (java:S2095 — resource leaks):
ScheduledExecutorServicecreated as local variable but never stored or shut down. Fixed by storing in a field and shutting down viaExecutorServiceManager.shutdownNow()incancelSessionListenerChecker()DynamicClassLoader(extendsURLClassLoader) never closed. Fixed with try-with-resourcessonar.java.source=${jdk.version}so SonarCloud analyzes against the correct API surface (HttpClient only implements AutoCloseable since Java 21, but project compiles with--release 17)// NOSONARor@SuppressWarnings("java:S2095")at statement level (not method level) with explanatory comments onAggregateReifier,ThreadsReifier,SalesforceComponent, andCamelYamlParserTest plan