nastra commented on code in PR #12140:
URL: https://github.com/apache/iceberg/pull/12140#discussion_r1939366674


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveMetastore.java:
##########
@@ -273,13 +274,13 @@ private void initConf(HiveConf conf, int port) {
   }
 
   private static void setupMetastoreDB(String dbURL) throws SQLException, 
IOException {
-    Connection connection = DriverManager.getConnection(dbURL);
-    ScriptRunner scriptRunner = new ScriptRunner(connection, true, true);
+    try (Connection connection = DriverManager.getConnection(dbURL)) {
+      ScriptRunner scriptRunner = new ScriptRunner(connection, true, true);
 
-    ClassLoader classLoader = ClassLoader.getSystemClassLoader();
-    InputStream inputStream = 
classLoader.getResourceAsStream("hive-schema-3.1.0.derby.sql");
-    try (Reader reader = new InputStreamReader(inputStream)) {
-      scriptRunner.runScript(reader);
+      InputStream inputStream = 
TestHiveMetastore.class.getClassLoader().getResourceAsStream("hive-schema-3.1.0.derby.sql");

Review Comment:
   please wrap this also in a try-with-resources block



-- 
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