Skip to content

Commit

Permalink
CallingClassUtils: replace Class.forName() with Context.getClassLoader()
Browse files Browse the repository at this point in the history
Class.forName() will fail if the threads class loader is not set.
  • Loading branch information
maarzt committed Dec 9, 2020
1 parent 1e70db2 commit b80f6fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/scijava/log/CallingClassUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

package org.scijava.log;

import org.scijava.Context;

/**
* Utility class for getting the calling class of a method.
*
Expand Down Expand Up @@ -60,7 +62,7 @@ public static String getCallingClassName() {

private static boolean hasIgnoreAsCallingClassAnnotation(String className) {
try {
Class< ? > clazz = Class.forName(className);
Class< ? > clazz = Context.getClassLoader().loadClass(className);
return clazz.isAnnotationPresent(IgnoreAsCallingClass.class);
}
catch (ClassNotFoundException ignore) {
Expand Down

0 comments on commit b80f6fe

Please sign in to comment.