Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/808#discussion_r42575412
--- Diff:
tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
---
@@ -427,29 +408,20 @@ public void dropTablespace(String tableSpaceName)
throws UndefinedTablespaceExce
}
private Collection<String> getAllTablespaceNamesInternal(@Nullable
String whereCondition) {
- Connection conn = null;
- PreparedStatement pstmt = null;
- ResultSet resultSet = null;
-
List<String> tablespaceNames = new ArrayList<>();
- try {
- String sql = "SELECT SPACE_NAME FROM " + TB_SPACES;
+ String sql = "SELECT SPACE_NAME FROM " + TB_SPACES;
- if (whereCondition != null) {
- sql += " WHERE " + whereCondition;
- }
+ if (whereCondition != null) {
+ sql += " WHERE " + whereCondition;
+ }
- conn = getConnection();
- pstmt = conn.prepareStatement(sql);
- resultSet = pstmt.executeQuery();
+ try (ResultSet resultSet =
getConnection().prepareStatement(sql).executeQuery()) {
--- End diff --
PreparedStatement is not closed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---