Permalink
Browse files

set InvocationTargetException target

When using the OpenJDK classpath, the target exception and the
Throwable cause are two different fields; we must set them both.
  • Loading branch information...
1 parent 81d7786 commit b4c3eea0f1e7385b679220dd322bb93990ab11fd @dicej dicej committed Apr 18, 2013
Showing with 5 additions and 0 deletions.
  1. +2 −0 classpath/java/lang/reflect/InvocationTargetException.java
  2. +3 −0 src/avian/classpath-common.h
@@ -11,6 +11,8 @@
package java.lang.reflect;
public class InvocationTargetException extends Exception {
+ private Throwable target; // for compatibility with OpenJDK
+
public InvocationTargetException(Throwable targetException, String message) {
super(message, targetException);
}
@@ -561,6 +561,9 @@ invoke(Thread* t, object method, object instance, object args)
object exception = t->exception;
t->exception = makeThrowable
(t, Machine::InvocationTargetExceptionType, 0, 0, exception);
+
+ set(t, t->exception, InvocationTargetExceptionTarget,
+ throwableCause(t, t->exception));
}
});

0 comments on commit b4c3eea

Please sign in to comment.