You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by el...@apache.org on 2019/03/26 14:08:54 UTC

[calcite-avatica] branch master updated: [CALCITE-2950] Avatica DriverVersion.load leaks InputStream

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

elserj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite-avatica.git


The following commit(s) were added to refs/heads/master by this push:
     new 41ebf43  [CALCITE-2950] Avatica DriverVersion.load leaks InputStream
41ebf43 is described below

commit 41ebf43f63c36b49c3e6158f0c432197ae43efe9
Author: liaoxiaobo <li...@yunnex.com>
AuthorDate: Mon Mar 25 11:32:01 2019 +0800

    [CALCITE-2950] Avatica DriverVersion.load leaks InputStream
    
    Signed-off-by: Josh Elser <el...@apache.org>
---
 core/src/main/java/org/apache/calcite/avatica/DriverVersion.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java b/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
index 9b8bcf7..7c97778 100644
--- a/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
+++ b/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
@@ -96,9 +96,8 @@ public class DriverVersion {
     int minorVersion = 0;
     int databaseMajorVersion = 0;
     int databaseMinorVersion = 0;
-    try {
-      final InputStream inStream =
-          driverClass.getClassLoader().getResourceAsStream(resourceName);
+    try (final InputStream inStream =
+          driverClass.getClassLoader().getResourceAsStream(resourceName)) {
       if (inStream != null) {
         final Properties properties = new Properties();
         properties.load(inStream);