Code example for InvocationTargetException

Methods: getCause

0
    public R invoke(T target, Object... args) {
        try { 
            Object result = method.invoke(target, args);
            return returnType.cast(result);
        } catch (InvocationTargetException e) {
            throw UncheckedException.throwAsUncheckedException(e.getCause());
        } catch (Exception e) {
            throw new GradleException(String.format("Could not call %s.%s() on %s", method.getDeclaringClass().getSimpleName(), method.getName(), target), e);
        } 
    } 
 
    public Method getMethod() {
        return method;
    } 
 
    public Class<?>[] getParameterTypes(){
        return method.getParameterTypes();
    } 
} 
Experience pair programming with AI  Get Codota for Java