This test deserves some cleanup and I suspect the intermittent failure may be related to running in agent mode.
Mandy diff --git a/test/tools/jlink/SecurityTest.java b/test/tools/jlink/SecurityTest.java --- a/test/tools/jlink/SecurityTest.java +++ b/test/tools/jlink/SecurityTest.java @@ -25,7 +25,7 @@ * @test * @summary Test JlinkPermission * @author Jean-Francois Denise - * @run main SecurityTest + * @run main/othervm SecurityTest */ import java.security.AccessControlException; @@ -36,16 +36,11 @@ public static void main(String[] args) throws Exception { new Jlink(); System.setSecurityManager(new SecurityManager()); - boolean failed = false; try { new Jlink(); - failed = true; + throw new Exception("Call should have failed"); } catch (AccessControlException ex) { - //XXX OK. + // expected exception } - if (failed) { - throw new Exception("Call should have failed"); } - } -}