Skip to content

Commit 17b6229

Browse files
gnodetclaude
andcommitted
CAMEL-23271: Move @SuppressWarnings to statement level
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>
1 parent 9271179 commit 17b6229

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AggregateReifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public Processor createProcessor() throws Exception {
5050
return createAggregator();
5151
}
5252

53-
@SuppressWarnings("java:S2095") // ExecutorService lifecycle is managed by AggregateProcessor via shutdownThreadPool flag
5453
protected AggregateProcessor createAggregator() throws Exception {
5554
Processor childProcessor = this.createChildProcessor(true);
5655

@@ -77,6 +76,8 @@ protected AggregateProcessor createAggregator() throws Exception {
7776

7877
boolean parallel = parseBoolean(definition.getParallelProcessing(), false);
7978
boolean shutdownThreadPool = willCreateNewThreadPool(definition, parallel);
79+
// ExecutorService lifecycle is managed by AggregateProcessor via shutdownThreadPool flag
80+
@SuppressWarnings("java:S2095")
8081
ExecutorService threadPool = getConfiguredExecutorService("Aggregator", definition, parallel);
8182
if (threadPool == null && !parallel) {
8283
// executor service is mandatory for the Aggregator

core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ThreadsReifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public ThreadsReifier(Route route, ProcessorDefinition<?> definition) {
3434
super(route, (ThreadsDefinition) definition);
3535
}
3636

37-
@SuppressWarnings("java:S2095") // ExecutorService lifecycle is managed by ThreadsProcessor via shutdownThreadPool flag
3837
@Override
3938
public Processor createProcessor() throws Exception {
4039
// the threads name
@@ -44,6 +43,8 @@ public Processor createProcessor() throws Exception {
4443
}
4544
// prefer any explicit configured executor service
4645
boolean shutdownThreadPool = willCreateNewThreadPool(definition, true);
46+
// ExecutorService lifecycle is managed by ThreadsProcessor via shutdownThreadPool flag
47+
@SuppressWarnings("java:S2095")
4748
ExecutorService threadPool = getConfiguredExecutorService(name, definition, false);
4849

4950
// resolve what rejected policy to use

dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/CamelYamlParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@
4949
*/
5050
public class CamelYamlParser {
5151

52-
@SuppressWarnings("java:S2095") // Registry is owned by CamelContext; CamelContext is stopped in finally block
5352
public List<ValidationMessage> parse(File file) throws Exception {
53+
// CamelContext is stopped in finally block
54+
@SuppressWarnings("java:S2095")
5455
CamelContext camelContext = null;
5556
try {
5657
DefaultRegistry registry = new DefaultRegistry();

0 commit comments

Comments
 (0)