You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/07/20 05:08:52 UTC

svn commit: r423732 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp

Author: geirm
Date: Wed Jul 19 20:08:52 2006
New Revision: 423732

URL: http://svn.apache.org/viewvc?rev=423732&view=rev
Log:
HARMONY-927

vm shutdown looks for and clear any exceptions that
might be pending

Aso modified code format a tad

Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp?rev=423732&r1=423731&r2=423732&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp Wed Jul 19 20:08:52 2006
@@ -266,18 +266,28 @@
 
     JNIEnv* jenv = (JNIEnv*) jni_native_intf;
 
+    /*
+     * Make shutdown resistant to possible exceptions left in JNI code
+     */
+    if (jenv->ExceptionOccurred()) {
+        PROCESS_EXCEPTION("Exception left unhandled before destroying VM");
+    }
+
     jclass start_class = jenv->FindClass("java/lang/VMStart");
-    if (jenv->ExceptionOccurred() || !start_class)
+    if (jenv->ExceptionOccurred() || !start_class) {
         PROCESS_EXCEPTION("can't find starter class: java/lang/VMStart");
+    }
 
     jmethodID shutdown_method = jenv->GetStaticMethodID(start_class, "shutdown", "()V");
-    if (jenv->ExceptionOccurred() || !shutdown_method)
+    if (jenv->ExceptionOccurred() || !shutdown_method) {
         PROCESS_EXCEPTION("can't find initialize method in class java/lang/VMStart");
+    }
 
     jenv->CallStaticVoidMethod(start_class, shutdown_method);
-    if (jenv->ExceptionOccurred())
+    if (jenv->ExceptionOccurred()) {
         PROCESS_EXCEPTION("error during shutdown() method execution");
-
+    }
+    
     return 0;
 } //run_java_shutdown