From 4c900e6864ddc8ceba24727b9577f03aebeaeb5e Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Mon, 26 Jun 2023 16:03:57 +0200 Subject: [PATCH] Fixed classLoader --- src/main/java/org/gcube/gcat/utils/Constants.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/gcat/utils/Constants.java b/src/main/java/org/gcube/gcat/utils/Constants.java index 59b2a20..aca77ac 100644 --- a/src/main/java/org/gcube/gcat/utils/Constants.java +++ b/src/main/java/org/gcube/gcat/utils/Constants.java @@ -31,9 +31,10 @@ public class Constants { try { if(clientSecret==null) { Properties properties = new Properties(); - URL url = Constants.class.getClassLoader().getResource(CLIENT_SECRET_FILENAME); + ClassLoader classLoader = Constants.class.getClassLoader(); + URL url = classLoader.getResource(CLIENT_SECRET_FILENAME); logger.trace("Going to read {} at {}", CLIENT_SECRET_FILENAME, url.toString()); - InputStream input = ClassLoader.getSystemClassLoader().getResourceAsStream(CLIENT_SECRET_FILENAME); + InputStream input = classLoader.getResourceAsStream(CLIENT_SECRET_FILENAME); properties.load(input); int index = context.indexOf('/', 1); String root = context.substring(0, index == -1 ? context.length() : index);