Skip to content

Commit

Permalink
try to handle case where JVM is too new and has dropped SecurityManager
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 4, 2024
1 parent 48fab61 commit 43067dc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/io/cryostat/agent/ConfigModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,22 @@ public static Config provideConfig() {
fns.add(Pair.of("Simple", ConfigProvider::getConfig));
Function<Callable<ClassLoader>, Callable<Config>> clConfigLoader =
cl ->
() ->
ConfigProvider.getConfig(
() -> {
ClassLoader loader;
try {
loader =
AccessController.doPrivileged(
(PrivilegedExceptionAction<ClassLoader>)
cl.call()));
() -> cl.call());
} catch (Exception e) {
log.warn(
"ClassLoader AccessController failure - is this JVM too new"
+ " to have the AccessController and SecurityManager?",
e);
loader = cl.call();
}
return ConfigProvider.getConfig(loader);
};
fns.add(
Pair.of(
"ResourcesUtil ClassLoader",
Expand Down

0 comments on commit 43067dc

Please sign in to comment.