private Object doInvoke(MethodInvoker invoker) throws Exception{
try {
invoker.prepare();
}
catch (ClassNotFoundException e) {
throw new DynamicMethodInvocationException(e);
}
catch (NoSuchMethodException e) {
throw new DynamicMethodInvocationException(e);
}
try {
return invoker.invoke();
}
catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
}
else {
throw new InvocationTargetThrowableWrapper(e.getCause());
}
}
catch (IllegalAccessException e) {
throw new DynamicMethodInvocationException(e);
}
}