System.exit() forbidden by JT Harness in agentvm mode

Jonathan Gibbons jonathan.gibbons at
Tue Dec 10 14:04:19 PST 2013

In othervm mode, no restrictions are placed on the JVM, and by default, 
no security manager is installed, so tests can play with all those 
"dangerous" calls in java.lang.System all they want.  We need to be able 
to write tests that call System.exit or System.setProperties(new 
Properties()); etc

By contrast, in samevm and agentvm modes, there is a presumption that a 
test will be reasonably well behaved, but just in case, we install a 
security manager to make sure.

-- Jon

P.S. I remember when someone wrote a test for System.setProperties that 
removed the definition of System.lineSeparator, causing jtreg to crash 
as soon as it tried to write the test results.

On 12/10/2013 02:02 PM, Volker Simonis wrote:
> Hi Jonathan,
> thanks for you comments. But there's still one thing I 
> don't understand: what's the exact reason that tests in the agentvm 
> mode are  running under a special security manager while test running 
> in othervm mode aren't restricted in this way. Is this really necessary?
> Regards,
> Volker

More information about the quality-discuss mailing list