You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2006/11/16 06:50:01 UTC

svn commit: r475590 - in /incubator/harmony/enhanced/drlvm/trunk/vm: tests/kernel/java/lang/reflect/MethodTestInvoke.java vmcore/src/exception/exceptions_impl.cpp

Author: varlax
Date: Wed Nov 15 21:50:01 2006
New Revision: 475590

URL: http://svn.apache.org/viewvc?view=rev&rev=475590
Log:
Fixed regression in exceptions, added test.
Kernel tests pass now

Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTestInvoke.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTestInvoke.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTestInvoke.java?view=diff&rev=475590&r1=475589&r2=475590
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTestInvoke.java (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/MethodTestInvoke.java Wed Nov 15 21:50:01 2006
@@ -29,7 +29,27 @@
 
 import junit.framework.TestCase;
 
-@SuppressWarnings(value={"all"}) public class MethodTestInvoke extends TestCase {
+@SuppressWarnings(value={"all"}) 
+public class MethodTestInvoke extends TestCase {
+    
+    static class MyException extends RuntimeException {}
+    
+    public static void doFail() {
+        throw new MyException();
+    }
+    
+    /**
+     * Tests that correct cause of reflection error is provided.
+     */
+    public void testInvocationTargetExceptionCause() throws Exception {
+        try {
+            this.getClass().getMethod("doFail").invoke(null);
+        } catch (InvocationTargetException e) {
+            Throwable cause = e.getCause();
+            assertTrue("Unexpected cause: " + cause, 
+                    cause instanceof MyException);
+        }
+    }
 
     int state = 0;
     

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp?view=diff&rev=475590&r1=475589&r2=475590
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp Wed Nov 15 21:50:01 2006
@@ -281,7 +281,7 @@
 
         if (NULL != exception->exc_cause) {
             tmn_suspend_disable_recursive();
-            jthrowable exc_cause = oh_allocate_local_handle();
+            exc_cause = oh_allocate_local_handle();
             exc_cause->object = exception->exc_cause;
             tmn_suspend_enable_recursive();
         }