Skip to content

Commit 64dc4b1

Browse files
committedOct 23, 2020
8255225: compiler/aot tests fail on Windows with NPE during artifact resolution
Reviewed-by: erikj, clanger
1 parent a824781 commit 64dc4b1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed
 

‎test/lib/jdk/test/lib/artifacts/ArtifactResolverException.java

+13-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ public ArtifactResolverException(String message, Throwable cause) {
1414
}
1515

1616
public String toString() {
17-
return super.toString() + ": " + getRootCause().toString();
17+
Throwable root = getRootCause();
18+
if (root != null) {
19+
return super.toString() + ": " + root.toString();
20+
} else {
21+
return super.toString();
22+
}
1823
}
1924

2025
public Throwable getRootCause() {
21-
Throwable rootCause = getCause();
22-
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
23-
rootCause = rootCause.getCause();
26+
Throwable root = getCause();
27+
if (root == null) {
28+
return null;
29+
}
30+
while (root.getCause() != null && root.getCause() != root) {
31+
root = root.getCause();
2432
}
25-
return rootCause;
33+
return root;
2634
}
2735
}

0 commit comments

Comments
 (0)
Please sign in to comment.