[
https://issues.apache.org/jira/browse/TAJO-1877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14966091#comment-14966091
]
ASF GitHub Bot commented on TAJO-1877:
--------------------------------------
Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/808#discussion_r42575433
--- Diff:
tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
---
@@ -457,17 +429,11 @@ public void dropTablespace(String tableSpaceName)
throws UndefinedTablespaceExce
@Override
public List<TablespaceProto> getTablespaces() {
- Connection conn = null;
- Statement stmt = null;
- ResultSet resultSet = null;
List<TablespaceProto> tablespaces = TUtil.newList();
- try {
- String sql = "SELECT SPACE_ID, SPACE_NAME, SPACE_HANDLER, SPACE_URI
FROM " + TB_SPACES ;
- conn = getConnection();
- stmt = conn.createStatement();
- resultSet = stmt.executeQuery(sql);
+ String sql = "SELECT SPACE_ID, SPACE_NAME, SPACE_HANDLER, SPACE_URI
FROM " + TB_SPACES ;
+ try (ResultSet resultSet =
getConnection().createStatement().executeQuery(sql)) {
--- End diff --
PreparedStatement is not closed.
> Adopt try-resource statement to AbstractDBStore
> -----------------------------------------------
>
> Key: TAJO-1877
> URL: https://issues.apache.org/jira/browse/TAJO-1877
> Project: Tajo
> Issue Type: Sub-task
> Components: Catalog
> Reporter: Hyunsik Choi
> Assignee: Dongkyu Hwangbo
> Labels: newbie
>
> See
> https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html.
> JDK 7 introduced try-resource statement for better resource allocation and
> deallocation. We can also adopt this feature to AbstractDBStore.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)