System.exit() forbidden by JT Harness in agentvm mode
Volker Simonis
volker.simonis at gmail.com
Tue Dec 10 07:37:12 PST 2013
Hi,
when running the
com/sun/java/swing/plaf/windows/8016551/bug8016551.java regression
test with the newest version of jtreg (build from source) in agentvm
mode I get the following error:
----------System.err:(33/2049)----------
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1300)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1275)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1350)
at bug8016551.main(bug8016551.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:754)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.SecurityException: System.exit() forbidden by JT Harness
at com.sun.javatest.JavaTestSecurityManager.checkExit(JavaTestSecurityManager.java:117)
at javax.swing.JFrame.setDefaultCloseOperation(JFrame.java:395)
at bug8016551$1.run(bug8016551.java:57)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
If the test is run in othervm mode it succeeds.
I looked at this problem a litter loser and found out the following:
- there are 99 test which use JFrame.setDefaultCloseOperation(EXIT_ON_CLOSE)
- they are in java/awt (15), javax/swing (79), sun/java2d (3),
javax/imageio/plugins/gif/GifTransparencyTest.java
(setDefaultCloseOperation present but never called) and
com/sun/java/swing/plaf/windows/8016551/bug8016551.java
- all test in java/awt and sun/java2d are always executed in othervm
mode anyway (because of 'othervm.dirs=java/awt ..' in TEST.ROOT)
Now I'm not sure if this security-exception is right at this place -
i.e. if jtreg/jtharness work as expected here.
If yes and if there's no option/workaround to switch this behaviour
off, we should either add 'javax/swing' as well to the 'othervm.dirs'
list in TEST.ROOT and explicitly flag the remain test to require
othervm mode by adding the corresponding '@run main/othervm' tag to
the java source file.
If adding 'javax/swing' to 'othervm.dirs' is considered to general, we
would have to explicitly flag each single test with '@run
main/othervm'.
What do you think?
Volker
PS: there are 208 test which call System.exit() directly. I haven't
analysed them until now, but the same reasoning applies for them as
well.
More information about the code-tools-dev
mailing list