From b4c3eea0f1e7385b679220dd322bb93990ab11fd Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 18 Apr 2013 11:23:59 -0600 Subject: [PATCH] set InvocationTargetException target When using the OpenJDK classpath, the target exception and the Throwable cause are two different fields; we must set them both. --- classpath/java/lang/reflect/InvocationTargetException.java | 2 ++ src/avian/classpath-common.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/classpath/java/lang/reflect/InvocationTargetException.java b/classpath/java/lang/reflect/InvocationTargetException.java index abac51cb43..362bfb0788 100644 --- a/classpath/java/lang/reflect/InvocationTargetException.java +++ b/classpath/java/lang/reflect/InvocationTargetException.java @@ -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); } diff --git a/src/avian/classpath-common.h b/src/avian/classpath-common.h index a9e4c3a834..eede892293 100644 --- a/src/avian/classpath-common.h +++ b/src/avian/classpath-common.h @@ -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)); } });