*/
package org.apache.tomcat.jdbc.pool;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
return connection.getConnection();
}
if (isClosed()) throw new SQLException("Connection has already been closed.");
- return method.invoke(connection.getConnection(),args);
+ try {
+ return method.invoke(connection.getConnection(),args);
+ }catch (Throwable t) {
+ if (t instanceof InvocationTargetException) {
+ InvocationTargetException it = (InvocationTargetException)t;
+ throw it.getCause()!=null?it.getCause():it;
+ } else {
+ throw t;
+ }
+ }
}
public boolean isClosed() {
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.CallableStatement;
result = method.invoke(delegate,args);
}catch (Throwable t) {
reportFailedQuery(query,args,name,start,t);
- throw t;
+ if (t instanceof InvocationTargetException) {
+ InvocationTargetException it = (InvocationTargetException)t;
+ throw it.getCause()!=null?it.getCause():it;
+ } else {
+ throw t;
+ }
}
//measure the time
long delta = (process)?(System.currentTimeMillis()-start):Long.MIN_VALUE;