Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8209771

jdk.test.lib.Utils::runAndCheckException error

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b09

      Backports

        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.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                weijun Weijun Wang
                Reporter:
                weijun Weijun Wang
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: