gnodet-bot commented on code in PR #30083:
URL: https://github.com/apache/camel/pull/30083#discussion_r4579222125


##########
components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java:
##########
@@ -335,6 +347,24 @@ private void closeQuietly(Statement stmt) {
         }
     }
 
+    private void commitQuietly(Connection con) {
+        try {
+            con.commit();
+        } catch (Exception sqle) {
+            LOG.warn("Error occurred during JDBC commit. This exception will 
be ignored.", sqle);
+        }
+    }

Review Comment:
   💡 **Minor inconsistency:** `rollbackQuietly` guards against a `null` `con` 
with `if (con != null)`, but `commitQuietly` does not. While the current call 
site (`finalConn`) is non-null by the time `commitQuietly` is invoked, adding 
the same guard makes the methods symmetric and prevents a potential NPE if the 
method is reused elsewhere in the future:
   
   ```suggestion
       private void commitQuietly(Connection con) {
           try {
               if (con != null) {
                   con.commit();
               }
           } catch (Exception sqle) {
               LOG.warn("Error occurred during JDBC commit. This exception will 
be ignored.", sqle);
           }
       }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to