Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P4
-
Resolution: Fixed
-
Affects Version/s: 11, 12
-
Fix Version/s: 12
-
Component/s: other-libs
-
Subcomponent:
-
Resolved In Build:b09
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8229877 | 11.0.6-oracle | Sean Coffey | P4 | Resolved | Fixed | b01 |
JDK-8233973 | 11.0.6 | Weijun Wang | P4 | Resolved | Fixed | b04 |
Description
test/lib/jdk/test/lib/Utils.java
public static void runAndCheckException(Runnable runnable, Consumer<Throwable> checkException) {
try {
runnable.run();
checkException.accept(null);
} catch (Throwable t) {
checkException.accept(t);
}
}
Suppose checkException.accept(null) throws a Throwable itself it will be caught and accepted again.
Also, since this method is mainly used to check for exceptions thrown by runnable, it's better to use ThrowingRunnable (defined in the same source file) than Runnable.
public static void runAndCheckException(Runnable runnable, Consumer<Throwable> checkException) {
try {
runnable.run();
checkException.accept(null);
} catch (Throwable t) {
checkException.accept(t);
}
}
Suppose checkException.accept(null) throws a Throwable itself it will be caught and accepted again.
Also, since this method is mainly used to check for exceptions thrown by runnable, it's better to use ThrowingRunnable (defined in the same source file) than Runnable.
Attachments
Issue Links
- backported by
-
JDK-8229877 jdk.test.lib.Utils::runAndCheckException error
-
- Resolved
-
-
JDK-8233973 jdk.test.lib.Utils::runAndCheckException error
-
- Resolved
-