You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/04/03 06:31:00 UTC

[jira] [Created] (CAMEL-23289) camel-drill - Fix empty catch blocks and resource leaks in DrillProducer

Andrea Cosentino created CAMEL-23289:
----------------------------------------

             Summary: camel-drill - Fix empty catch blocks and resource leaks in DrillProducer
                 Key: CAMEL-23289
                 URL: https://issues.apache.org/jira/browse/CAMEL-23289
             Project: Camel
          Issue Type: Improvement
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


DrillProducer.java has three empty catch blocks that silently swallow exceptions, which can mask errors and lead to resource leaks:

1. *doStop() (line 57-60):* connection.close() failures are silently ignored — cleanup errors should be logged at WARN or DEBUG level so operators can diagnose connection issues.

2. *process() finally block (lines 76-83):* ResultSet and Statement are closed manually with empty catch blocks. These should use try-with-resources instead, which is cleaner and ensures proper close ordering.

3. *Null-safety:* If connection.createStatement() succeeds but st.executeQuery() throws, rs is still null when rs.close() is called in the finally block, causing a NullPointerException that is silently swallowed.

*Suggested fix:*
- Replace the manual finally block with try-with-resources for Statement and ResultSet
- Log connection close errors in doStop() instead of swallowing them
- These changes improve debuggability without changing component behavior



--
This message was sent by Atlassian Jira
(v8.20.10#820010)