You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2015/06/30 03:21:46 UTC
[53/57] [abbrv] hive git commit: HIVE-7150 FileInputStream is not
closed in HiveConnection class (Gabor Liptak and Alexander Pivovarov reviewed
by Xuefu Zhang)
HIVE-7150 FileInputStream is not closed in HiveConnection class (Gabor Liptak and Alexander Pivovarov reviewed by Xuefu Zhang)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2e08e5d0
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2e08e5d0
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2e08e5d0
Branch: refs/heads/llap
Commit: 2e08e5d073e76f2033278bec489d23cec93d65e6
Parents: db266db
Author: Alexander Pivovarov <ap...@gmail.com>
Authored: Fri Jun 26 20:19:57 2015 -0700
Committer: Alexander Pivovarov <ap...@gmail.com>
Committed: Sun Jun 28 22:12:17 2015 -0700
----------------------------------------------------------------------
.../java/org/apache/hive/jdbc/HiveConnection.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/2e08e5d0/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
index 277f6d4..959822e 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
@@ -391,8 +391,9 @@ public class HiveConnection implements java.sql.Connection {
} else {
// Pick trust store config from the given path
sslTrustStore = KeyStore.getInstance(JdbcConnectionParams.SSL_TRUST_STORE_TYPE);
- sslTrustStore.load(new FileInputStream(sslTrustStorePath),
- sslTrustStorePassword.toCharArray());
+ try (FileInputStream fis = new FileInputStream(sslTrustStorePath)) {
+ sslTrustStore.load(fis, sslTrustStorePassword.toCharArray());
+ }
socketFactory = new SSLSocketFactory(sslTrustStore);
}
socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
@@ -512,8 +513,9 @@ public class HiveConnection implements java.sql.Connection {
throw new IllegalArgumentException(JdbcConnectionParams.SSL_KEY_STORE
+ " Not configured for 2 way SSL connection, keyStorePath param is empty");
}
- sslKeyStore.load(new FileInputStream(keyStorePath),
- keyStorePassword.toCharArray());
+ try (FileInputStream fis = new FileInputStream(keyStorePath)) {
+ sslKeyStore.load(fis, keyStorePassword.toCharArray());
+ }
keyManagerFactory.init(sslKeyStore, keyStorePassword.toCharArray());
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(
@@ -527,8 +529,9 @@ public class HiveConnection implements java.sql.Connection {
throw new IllegalArgumentException(JdbcConnectionParams.SSL_TRUST_STORE
+ " Not configured for 2 way SSL connection");
}
- sslTrustStore.load(new FileInputStream(trustStorePath),
- trustStorePassword.toCharArray());
+ try (FileInputStream fis = new FileInputStream(trustStorePath)) {
+ sslTrustStore.load(fis, trustStorePassword.toCharArray());
+ }
trustManagerFactory.init(sslTrustStore);
SSLContext context = SSLContext.getInstance("TLS");
context.init(keyManagerFactory.getKeyManagers(),