8253660: Need better error report when artifact resolution fails in AotCompiler.java

Reviewed-by: ihse
This commit is contained in:
Erik Joelsson 2020-10-19 17:40:54 +00:00
parent 52cb3292ae
commit 0b5101658d
3 changed files with 14 additions and 1 deletions
test
hotspot/jtreg/compiler/aot
jdk/sun/security/pkcs11
lib/jdk/test/lib/artifacts

@ -268,6 +268,7 @@ public class AotCompiler {
}
} catch (ArtifactResolverException e) {
System.err.println("artifact resolution error: " + e);
e.printStackTrace(System.err);
// let jaotc try to find linker
return null;
}

@ -853,7 +853,7 @@ public abstract class PKCS11Test {
+ "please check if JIB jar is present in classpath.");
} else {
throw new RuntimeException("Fetch artifact failed: " + clazz
+ "\nPlease make sure the artifact is available.");
+ "\nPlease make sure the artifact is available.", e);
}
}
Policy.setPolicy(null); // Clear the policy created by JIB if any

@ -12,4 +12,16 @@ public class ArtifactResolverException extends Exception {
public ArtifactResolverException(String message, Throwable cause) {
super(message, cause);
}
public String toString() {
return super.toString() + ": " + getRootCause().toString();
}
public Throwable getRootCause() {
Throwable rootCause = getCause();
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
rootCause = rootCause.getCause();
}
return rootCause;
}
}