Menu

abbot.ExitException Error

Developers
Anonymous
2003-07-29
2003-07-30
  • Anonymous

    Anonymous - 2003-07-29

    Hi,  We have an application that exits via System.exit(0).  When this happens, Abbot throws an ExitException.  Why is abbot throwing this exception?  The stack trace is as follows and a sample testcase is below.

    abbot.ExitException: Caught application exit (0)
            at abbot.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:22)
            at abbot.editor.ScriptEditor$EditorSecurityManager.checkExit(ScriptEdito
    r.java:2508)
            at java.lang.Runtime.exit(Runtime.java:88)
            at java.lang.System.exit(System.java:713)
            at Test2.actionPerformed(Test2.java:32)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    64)
            at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1817)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:419)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
    )
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
            at java.awt.Component.processMouseEvent(Component.java:5134)
            at java.awt.Component.processEvent(Component.java:4931)
            at java.awt.Container.processEvent(Container.java:1566)
            at java.awt.Component.dispatchEventImpl(Component.java:3639)
            at java.awt.Container.dispatchEventImpl(Container.java:1623)
            at java.awt.Component.dispatchEvent(Component.java:3480)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450
    )
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)

            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
            at java.awt.Container.dispatchEventImpl(Container.java:1609)
            at java.awt.Window.dispatchEventImpl(Window.java:1590)
            at java.awt.Component.dispatchEvent(Component.java:3480)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:197)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:150)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)

            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)

            at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

    --------------------[source]-----------------------

    import java.lang.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;

    public class Test2 implements ActionListener {

        Test2() {

        JFrame frame = new JFrame("Exit Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.getContentPane().setLayout(new FlowLayout());

        JButton exitButton = new JButton("Exit");

        exitButton.addActionListener(this);

        frame.getContentPane().add(exitButton);
        frame.pack();
        frame.setVisible(true);
        }

        public void actionPerformed(ActionEvent e) {

        String cmd = e.getActionCommand();

        if (cmd.equals("Exit")) {
            System.exit(0);
        }
        }

        public static void main(String[] args) {
        new Test2();
        }

    }

     
    • Timothy Wall

      Timothy Wall - 2003-07-29

      This exception is shown only if logging is turned on.  It is simply a signal to indicate the application has attempted to exit so that the editor can respond accordingly.  It would be rather disrupting to the test environment (i.e the editor) if applications were allowed to exit.

      Only the editor itself is allowed to invoke System.exit.

      (as a matter of trivia, if the editor itself is being tested under the editor, it won't be allowed to exit either)

       
    • Anonymous

      Anonymous - 2003-07-29

      Logging appears to be turned on by default.  I edited properties.txt and  set abbot.editor.log_all_events=false.  This didn't make a difference though.  How do you turn off debugging information?

      Thanks,
      Alana

       
      • Timothy Wall

        Timothy Wall - 2003-07-29

        Normally logging is off.  You turn it on on the command line with "--log <filename>|-"

        properties.txt simply lists the properties that are recognized and their default values.  that file is not actually ever read.

         
    • Anonymous

      Anonymous - 2003-07-29

      The ExitException is displayed on console.

       
      • Timothy Wall

        Timothy Wall - 2003-07-29

        What platform are you on?  VM version?  Normally, the framework sets up a handler for uncaught exceptions on the event dispatch thread.  It must be able to do so, however, before any exception is actually thrown there.

        // This fixes things on OSX; in abbot.editor.ScriptEditor
        static {
          try {
            AbstractEventExceptionHandler.install(EventExceptionHandler.class);
            }
            catch(Exception e) {
            }
        }

         
    • Anonymous

      Anonymous - 2003-07-29

      Running on Windows XP Pro, and Java 1.4.1_02-b06.  Launching my testcase by extending scriptFixture and using ant to start things up and run it through junit.

       
      • Timothy Wall

        Timothy Wall - 2003-07-29

        ScriptFixture needs to implement an event exception handler similar to what ComponentTestFixture does.

        Assuming junit/ant do not install event exception handlers, any exceptions (other than ExitException) thrown on the event dispatch thread while your app is running should show up as errors.

        This functionality was added to ComponentTestFixture but not ScriptFixture.

         
      • Timothy Wall

        Timothy Wall - 2003-07-30

        I've changed ScriptFixture to be derived from ComponentTestFixture (as a partial step to factoring out the AWT fixture part from ComponentTestFixture).

        ScriptFixture will now benefit from the event dispatch exception handling.

        (you can try this yourself by extending ComponentTestFixture instead of ScriptFixture and copying the functionality of ScriptFixture into your fixture; it's rather trivial).

         

Log in to post a comment.