tajo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoonson <...@git.apache.org>
Subject [GitHub] tajo pull request: TAJO-1877: Adopt try-resource statement to Abst...
Date Wed, 21 Oct 2015 01:38:22 GMT
Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/808#discussion_r42575471
  
    --- Diff: tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
---
    @@ -708,18 +656,11 @@ public void dropDatabase(String databaseName) throws UndefinedDatabaseException
       
       @Override
       public List<DatabaseProto> getAllDatabases() {
    -    Connection conn = null;
    -    Statement stmt = null;
    -    ResultSet resultSet = null;
    -
         List<DatabaseProto> databases = new ArrayList<>();
     
    -    try {
    -      String sql = "SELECT DB_ID, DB_NAME, SPACE_ID FROM " + TB_DATABASES;
    +    String sql = "SELECT DB_ID, DB_NAME, SPACE_ID FROM " + TB_DATABASES;
     
    -      conn = getConnection();
    -      stmt = conn.createStatement();
    -      resultSet = stmt.executeQuery(sql);
    +    try (ResultSet resultSet = getConnection().createStatement().executeQuery(sql)) {
    --- 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message