Code example for InvocationTargetException

Methods: getTargetException

0
 
    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);
        } 
    } 
 
    @Override 
    public String toString() {
        final StringBuilder ret = new StringBuilder(method.getName()).append('(');
        boolean first = true;
        for (Object obj : args) {
            if (!first) {
                ret.append(", ");