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

mvm-on: java -XUseMServer still returns exit code 0 when application throws exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • mvm-hs16
    • mvm-7
    • hotspot
    • team
    • generic
    • generic

      If application throws exception, the exit code is always 0 (1 is expected).

      To reproduce, compile and run this program with -XUseMserver:

      $ java -XUseMServer -cp /tmp/t Main; echo $?
      Exception in thread "main"
      java.lang.RuntimeException: An exception
              at Main.main(Main.java:3)
      0


      public class Main {
              public static void main(String[] args) {
                      throw new RuntimeException("An exception");
              }
      }

      or use non-existing class:
      java -XUseMServer NonExistingClass;echo $?
      Exception in thread "main"
      java.lang.NoClassDefFoundError: NonExistingClass
      Caused by: java.lang.ClassNotFoundException: NonExistingClass
              at java.net.URLClassLoader$1.run(URLClassLoader.java:299)
              at java.net.URLClassLoader$1.run(URLClassLoader.java:288)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:287)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:429)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:328)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
      0

            coleenp Coleen Phillimore
            nhaustov Nicolay Haustov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: