Code example for InvocationTargetException

Methods: getTargetException

    protected static final double invokeMethod(Method method, Object[] args) throws EvaluationException {
        try { 
            return (Double) method.invoke(null, args);
        } catch (InvocationTargetException e) {
            if (e.getTargetException() instanceof EvaluationException) {
                throw (EvaluationException) e.getTargetException();
            throw new EvaluationException(-1, "Exception caught while evaluating expression", e.getTargetException());
        } catch (IllegalAccessException e) {
            throw new EvaluationException(-1, "Internal error while evaluating expression", e);
    public String toString() {
        final StringBuilder ret = new StringBuilder(method.getName()).append('(');
        boolean first = true;
        for (Object obj : args) {
            if (!first) {
Connect your IDE to all the code out there  Get Codota for Java