8255225: compiler/aot tests fail on Windows with NPE during artifact resolution

Reviewed-by: erikj, clanger
This commit is contained in:
Aleksey Shipilev 2020-10-23 06:34:17 +00:00
parent a824781b8c
commit 64dc4b1888

View File

@ -14,14 +14,22 @@ public class ArtifactResolverException extends Exception {
}
public String toString() {
return super.toString() + ": " + getRootCause().toString();
Throwable root = getRootCause();
if (root != null) {
return super.toString() + ": " + root.toString();
} else {
return super.toString();
}
}
public Throwable getRootCause() {
Throwable rootCause = getCause();
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
rootCause = rootCause.getCause();
Throwable root = getCause();
if (root == null) {
return null;
}
return rootCause;
while (root.getCause() != null && root.getCause() != root) {
root = root.getCause();
}
return root;
}
}