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


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveMetastore.java:
##########
@@ -273,13 +274,15 @@ 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);
-
-    ClassLoader classLoader = ClassLoader.getSystemClassLoader();
-    InputStream inputStream = 
classLoader.getResourceAsStream("hive-schema-3.1.0.derby.sql");
-    try (Reader reader = new InputStreamReader(inputStream)) {
-      scriptRunner.runScript(reader);
+    try (Connection connection = DriverManager.getConnection(dbURL)) {
+      ScriptRunner scriptRunner = new ScriptRunner(connection, true, true);
+      try (InputStream inputStream =
+              TestHiveMetastore.class
+                  .getClassLoader()
+                  .getResourceAsStream("hive-schema-3.1.0.derby.sql");
+          Reader reader = new 
InputStreamReader(Preconditions.checkNotNull(inputStream))) {

Review Comment:
   ```suggestion
             Reader reader = new 
InputStreamReader(Preconditions.checkNotNull(inputStream, "Invalid input 
stream: null"))) {
   ```



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