Properly handle InvocationTargetException in reflective JtaPlatform implementation
This commit is contained in:
parent
519f78c3f5
commit
70164cb145
|
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.orm.hibernate4;
|
package org.springframework.orm.hibernate4;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
import javax.transaction.Status;
|
import javax.transaction.Status;
|
||||||
|
|
@ -136,8 +137,15 @@ class ConfigurableJtaPlatform implements InvocationHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
Method targetMethod = getClass().getMethod(method.getName(), method.getParameterTypes());
|
try {
|
||||||
return targetMethod.invoke(this, args);
|
return getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(this, args);
|
||||||
|
}
|
||||||
|
catch (InvocationTargetException ex) {
|
||||||
|
throw ex.getTargetException();
|
||||||
|
}
|
||||||
|
catch (Throwable ex) {
|
||||||
|
throw new IllegalStateException("Failed to delegate to corresponding implementation method", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue