pvary commented on code in PR #13821:
URL: https://github.com/apache/iceberg/pull/13821#discussion_r2278371002


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java:
##########
@@ -127,21 +127,23 @@ private void initializeLockTables() {
       pool.run(
           conn -> {
             DatabaseMetaData dbMeta = conn.getMetaData();
-            ResultSet tableExists =
+            try (ResultSet rs =
                 dbMeta.getTables(
                     null /* catalog name */,
                     null /* schemaPattern */,
                     LOCK_TABLE_NAME /* tableNamePattern */,
-                    null /* types */);
-            if (tableExists.next()) {
-              LOG.debug("Flink maintenance lock table already exists");
-              return true;
+                    null /* types */)) {
+              if (rs.next()) {
+                LOG.debug("Flink maintenance lock table already exists");
+                return true;
+              }
             }
-
             LOG.info("Creating Flink maintenance lock table {}", 
LOCK_TABLE_NAME);
-            return conn.prepareStatement(CREATE_LOCK_TABLE_SQL).execute();
+            try (PreparedStatement ps = 
conn.prepareStatement(CREATE_LOCK_TABLE_SQL)) {
+              ps.execute();
+            }
+            return true;

Review Comment:
   Nit: newline 



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to