From 4fb2cccaa2b4bd09ca8e18dd9ba4f56b84a7dc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Kr=C3=A1l?= Date: Wed, 18 Sep 2019 14:32:02 +0200 Subject: [PATCH] Loading keystore resource if location starts with / (#4258) Loading keystore resource if location starts with / Signed-off-by: David Kral --- .../jersey/microprofile/restclient/RestClientProducer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/RestClientProducer.java b/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/RestClientProducer.java index 8d5de4ca420..d0c75ec2d34 100644 --- a/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/RestClientProducer.java +++ b/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/RestClientProducer.java @@ -329,11 +329,14 @@ private InputStream locationToStream(String location) throws IOException { if (location.startsWith(CLASSPATH_LOCATION)) { String resource = location.substring(CLASSPATH_LOCATION.length()); - // first try to read from teh same classloader as the rest client interface + // first try to read from the same classloader as the rest client interface InputStream result = interfaceType.getResourceAsStream(resource); if (null == result) { // and if not found, use the context classloader (for example in TCK, this is needed) result = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); + if (result == null && resource.startsWith("/")) { + result = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource.substring(1)); + } } return result; } else if (location.startsWith(FILE_LOCATION)) {