Skip to content

Commit

Permalink
Use the current thread's classloader for classes (#6926)
Browse files Browse the repository at this point in the history
Switch from using the caller's classloader to using the current thread's
classloader.
  • Loading branch information
snowe2010 authored Apr 26, 2023
1 parent b50cfee commit 1a61543
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ public static synchronized ImageNameSubstitutor instance() {
ImageNameSubstitutor configuredInstance;
try {
configuredInstance =
(ImageNameSubstitutor) Class.forName(configuredClassName).getConstructor().newInstance();
(ImageNameSubstitutor) Thread
.currentThread()
.getContextClassLoader()
.loadClass(configuredClassName)
.getConstructor()
.newInstance();
} catch (Exception e) {
throw new IllegalArgumentException(
"Configured Image Substitutor could not be loaded: " + configuredClassName,
Expand Down

0 comments on commit 1a61543

Please sign in to comment.