diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java index b6669e75364..30013773696 100644 --- a/test/lib/jdk/test/lib/process/ProcessTools.java +++ b/test/lib/jdk/test/lib/process/ProcessTools.java @@ -895,10 +895,10 @@ public final class ProcessTools { tg.uncaughtThrowable = error; } }); - if (tg.uncaughtThrowable != null) { - throw new RuntimeException(tg.uncaughtThrowable); - } vthread.join(); + if (tg.uncaughtThrowable != null) { + throw tg.uncaughtThrowable; + } } else if (wrapper.equals("Kernel")) { MainThreadGroup tg = new MainThreadGroup(); Thread t = new Thread(tg, () -> { @@ -913,7 +913,7 @@ public final class ProcessTools { t.start(); t.join(); if (tg.uncaughtThrowable != null) { - throw new RuntimeException(tg.uncaughtThrowable); + throw tg.uncaughtThrowable; } } else { mainMethod.invoke(null, new Object[] { classArgs });