From 1c38cec10fd9e992527c488ec6f100185ef49d44 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Fri, 15 Dec 2017 10:53:13 -0500 Subject: [PATCH] KEYCLOAK-4427 --- .../src/main/java/org/keycloak/common/util/KeystoreUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/org/keycloak/common/util/KeystoreUtil.java b/common/src/main/java/org/keycloak/common/util/KeystoreUtil.java index d84b2098a7..070d517beb 100755 --- a/common/src/main/java/org/keycloak/common/util/KeystoreUtil.java +++ b/common/src/main/java/org/keycloak/common/util/KeystoreUtil.java @@ -21,7 +21,6 @@ import org.keycloak.common.constants.GenericConstants; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.InputStream; import java.security.KeyPair; import java.security.KeyStore; @@ -47,7 +46,9 @@ public class KeystoreUtil { InputStream trustStream = null; if (filename.startsWith(GenericConstants.PROTOCOL_CLASSPATH)) { String resourcePath = filename.replace(GenericConstants.PROTOCOL_CLASSPATH, ""); - trustStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath); + if (Thread.currentThread().getContextClassLoader() != null) { + trustStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath); + } if (trustStream == null) { trustStream = KeystoreUtil.class.getResourceAsStream(resourcePath); }