Skip to content

Commit 36bd69e

Browse files
HIVE-27271: Client connection to HS2 fails when transportMode=http, ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL
Closes #4262
1 parent 4d9fdf2 commit 36bd69e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ protected boolean requestIsAborted(final HttpRequest request) {
803803
}
804804
sslTrustStore = KeyStore.getInstance(trustStoreType);
805805
try (FileInputStream fis = new FileInputStream(sslTrustStorePath)) {
806-
sslTrustStore.load(fis, sslTrustStorePassword.toCharArray());
806+
sslTrustStore.load(fis, sslTrustStorePassword != null ? sslTrustStorePassword.toCharArray() : null);
807807
}
808808
sslContext = SSLContexts.custom().loadTrustMaterial(sslTrustStore, null).build();
809809
socketFactory =
@@ -1035,7 +1035,7 @@ SSLConnectionSocketFactory getTwoWaySSLSocketFactory() throws SQLException {
10351035
+ " Not configured for 2 way SSL connection");
10361036
}
10371037
try (FileInputStream fis = new FileInputStream(trustStorePath)) {
1038-
sslTrustStore.load(fis, trustStorePassword.toCharArray());
1038+
sslTrustStore.load(fis, trustStorePassword != null ? trustStorePassword.toCharArray() : null);
10391039
}
10401040
trustManagerFactory.init(sslTrustStore);
10411041
SSLContext context = SSLContext.getInstance("TLS");

0 commit comments

Comments
 (0)