Skip to content

Commit fc95366

Browse files
committed
Merge pull request #92 from scijava/test-utils
TestUtils: valid calling code locations do not include .jar files
2 parents d2e2034 + 0d635f2 commit fc95366

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/scijava/test/TestUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ public static Map.Entry<Class<?>, String> getCallingCodeLocation(final Class<?>
203203
final Class<?> clazz;
204204
try {
205205
clazz = loader.loadClass(element.getClassName());
206+
final URL url = clazz.getResource("/" + clazz.getName().replace('.', '/') + ".class");
207+
if (url == null || !"file".equals(url.getProtocol())) {
208+
// the calling code location must be unpacked; Maven artifacts in $HOME/.m2/ are excluded
209+
continue;
210+
}
206211
}
207212
catch (ClassNotFoundException e) {
208213
throw new UnsupportedOperationException("Could not load " +

0 commit comments

Comments
 (0)