Skip to content

Commit b80f6fe

Browse files
committed
CallingClassUtils: replace Class.forName() with Context.getClassLoader()
Class.forName() will fail if the threads class loader is not set.
1 parent 1e70db2 commit b80f6fe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/scijava/log/CallingClassUtils.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
package org.scijava.log;
3131

32+
import org.scijava.Context;
33+
3234
/**
3335
* Utility class for getting the calling class of a method.
3436
*
@@ -60,7 +62,7 @@ public static String getCallingClassName() {
6062

6163
private static boolean hasIgnoreAsCallingClassAnnotation(String className) {
6264
try {
63-
Class< ? > clazz = Class.forName(className);
65+
Class< ? > clazz = Context.getClassLoader().loadClass(className);
6466
return clazz.isAnnotationPresent(IgnoreAsCallingClass.class);
6567
}
6668
catch (ClassNotFoundException ignore) {

0 commit comments

Comments
 (0)