From 3aff5eacbd90cc5fc791c9c96b8d114caee9ddb5 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Tue, 9 May 2023 16:36:21 +0000 Subject: [PATCH] 8307486: ProcessTools.java should wait until vthread is completed before checking exceptions Reviewed-by: dholmes, alanb --- test/lib/jdk/test/lib/process/ProcessTools.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 });