added try-with-resources nest
avoid manually closing statements, and safetly handles resources.
@@ -190,8 +190,8 @@ public class DatabaseMetaDataTest extends AbstractTest {
UUID id = UUID.randomUUID();
String testCatalog = "dash-catalog" + id;
String testSchema = "some-schema" + id;
- Statement stmt = connection.createStatement();
+ try (Statement stmt = connection.createStatement()) {
try (Connection dashConn = DriverManager.getConnection(connectionString); Statement dashStatement = dashConn.createStatement()) {
Utils.dropDatabaseIfExists(testCatalog, stmt);
@@ -231,7 +231,7 @@ public class DatabaseMetaDataTest extends AbstractTest {
finally {
Utils.dropDatabaseIfExists(testCatalog, stmt);
}
- stmt.close();
+ }
}
/**
@@ -244,8 +244,8 @@ public class DatabaseMetaDataTest extends AbstractTest {
UUID id = UUID.randomUUID();
String testCatalog = "dash-catalog" + id;
String testSchema = "some-schema" + id;
- Statement stmt = connection.createStatement();
+ try (Statement stmt = connection.createStatement()) {
try (Connection dashConn = DriverManager.getConnection(connectionString); Statement dashStatement = dashConn.createStatement()) {
Utils.dropDatabaseIfExists(testCatalog, stmt);
@@ -278,7 +278,7 @@ public class DatabaseMetaDataTest extends AbstractTest {
finally {
Utils.dropDatabaseIfExists(testCatalog, stmt);
}
- stmt.close();
+ }
}
/**
