From 25f89e7403206fe0a0107769d7f25e11b815b6c3 Mon Sep 17 00:00:00 2001 From: Star Poon Date: Thu, 12 Oct 2023 08:41:14 +0900 Subject: [PATCH] Load default Java truststore for --use-system-truststore --- .../src/main/java/io/trino/client/OkHttpUtil.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/trino-client/src/main/java/io/trino/client/OkHttpUtil.java b/client/trino-client/src/main/java/io/trino/client/OkHttpUtil.java index 7d9a2935f611..77c5121b3943 100644 --- a/client/trino-client/src/main/java/io/trino/client/OkHttpUtil.java +++ b/client/trino-client/src/main/java/io/trino/client/OkHttpUtil.java @@ -303,8 +303,16 @@ else if (osName.contains("Mac")) { } } - KeyStore trustStore = KeyStore.getInstance(systemTrustStoreType.orElseGet(KeyStore::getDefaultType)); - trustStore.load(null, null); + KeyStore trustStore; + if (systemTrustStoreType.isPresent()) { + trustStore = KeyStore.getInstance(systemTrustStoreType.orElseGet(KeyStore::getDefaultType)); + trustStore.load(null, null); + } + else { + // return null if trustStoreType isn't specified and osName is unknown + // trustManagerFactory.init(null) will try to load the default Java trustStore + trustStore = null; + } return trustStore; }