You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by so...@apache.org on 2020/04/24 22:32:50 UTC

[openjpa] branch master updated: [OPENJPA-2810] try-with-resource to check jira-git integration

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a57904  [OPENJPA-2810] try-with-resource to check jira-git integration
2a57904 is described below

commit 2a579043550b1cc4d1e6348ff65b8bb86c861928
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Sat Apr 25 05:32:35 2020 +0700

    [OPENJPA-2810] try-with-resource to check jira-git integration
---
 .../main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
index ed181b2..82ee861 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
@@ -4662,11 +4662,9 @@ public class DBDictionary
             return null;
 
         beforeMetadataOperation(conn);
-        ResultSet keys = null;
-        try {
-            keys = meta.getImportedKeys(getCatalogNameForMetadata(catalog),
+        try (ResultSet keys = meta.getImportedKeys(getCatalogNameForMetadata(catalog),
                 getSchemaNameForMetadata(schemaName),
-                getTableNameForMetadata(tableName));
+                getTableNameForMetadata(tableName))) {
 
             List<ForeignKey> importedKeyList = new ArrayList<>();
             Map<FKMapKey, ForeignKey> fkMap = new HashMap<>();
@@ -4685,13 +4683,6 @@ public class DBDictionary
             }
             return (ForeignKey[]) importedKeyList.toArray
                 (new ForeignKey[importedKeyList.size()]);
-        } finally {
-            if (keys != null) {
-                try {
-                    keys.close();
-                } catch (Exception e) {
-                }
-            }
         }
     }