Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4109307

(process spec) multiple invocations of System.exit

XMLWordPrintable

    • sparc
    • solaris_2.4

      Name: akC45999 Date: 02/04/98



        Neither the JVMS nor the Java API says anything on what exit code
      will be returned when method System.exit(int status) is invoked
      twice (or more times) like in the following example:

      --------------------- execution07501.java
      import java.io.PrintStream;

      public class execution07501 {

        public static execution07501 x = new execution07501();

        public static int run(String argv[], PrintStream out) {
      execution07501.out = out;
      out.println("Cannot check in sameVM mode");
      return 0/*STATUS_PASSED*/;
        }

        public static void main(String argv[]) {
      try {
      System.runFinalizersOnExit(true);
      } catch (java.lang.SecurityException e) {
      out.println("Cannot check: " + e);
      System.exit(95/*STATUS_TEMP*/);
      }
      System.exit(0);
        }

        public void finalize() {
      out.println("finalize invocation");
      System.exit(95/*STATUS_TEMP*/);
        }

        static PrintStream out = System.out;

      }
      --------------------- end of execution07501.java


        The actual behavior of the jdk (1.2b3*) is exiting witn status 95, that
      means the exit status is taken from the dynamically latest invocation of
      method System.exit.

      ======================================================================
      ======================================================================

            Unassigned Unassigned
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: