[ 
https://issues.apache.org/jira/browse/CAMEL-23289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Cosentino updated CAMEL-23289:
-------------------------------------
    Fix Version/s: 4.19.0

> 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
>            Priority: Minor
>             Fix For: 4.19.0
>
>
> 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)

Reply via email to