Skip to content

Commit 0d635f2

Browse files
committed
TestUtils: valid calling code locations do not include .jar files
The whole point of the getCallingCodeLocation() method in the TestUtils class is to be able to determine a unique location for a directory inside the target/ directory of the current Maven project. Therefore, code locations in .jar files are not appropriate: there is no associated target/ directory. Thanks, Jaspar Jenkins, for running the regression tests so faithfully and pointing out that the imagej-plugins-uploader-{ssh,webdav} projects require this change to run their integration tests properly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent d2e2034 commit 0d635f2

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)