diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java index 24978b04679..7052fefe3b8 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java @@ -99,9 +99,11 @@ public class CompileTheWorld { } catch (Throwable t){ t.printStackTrace(ERR); } finally { - try { - OUT.close(); - } catch (Throwable ignore) { + if (OUT != System.out) { + try { + OUT.close(); + } catch (Throwable ignore) { + } } // might have started new threads System.exit(passed ? 0 : 1);