Example usage for javax.servlet.jsp.el ELException toString

List of usage examples for javax.servlet.jsp.el ELException toString

Introduction

In this page you can find the example usage for javax.servlet.jsp.el ELException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:com.streamsets.datacollector.el.ELEvaluator.java

public static void parseEL(String el) throws ELEvalException {
    try {/*from ww w  .ja  v  a  2s . c  o m*/
        EVALUATOR.parseExpressionString(el);
    } catch (ELException e) {
        LOG.debug("Error parsering EL '{}': {}", el, e.toString(), e);
        throw new ELEvalException(CommonError.CMN_0105, el, e.toString(), e);
    }
}

From source file:com.streamsets.datacollector.el.ELEvaluator.java

@Override
@SuppressWarnings("unchecked")
public <T> T evaluate(final ELVars vars, String expression, Class<T> returnType) throws ELEvalException {
    VariableResolver variableResolver = new VariableResolver() {

        @Override//from   ww  w  .  j ava2 s.  c  o  m
        public Object resolveVariable(String name) throws ELException {
            Object value = constants.get(name);
            if (!vars.hasVariable(name)) {
                if (value == null && !constants.containsKey(name)) {
                    throw new ELException(Utils.format("Constants/Variable '{}' cannot be resolved", name));
                }
            } else {
                value = vars.getVariable(name);
            }
            return value;
        }
    };
    try {
        return (T) EVALUATOR.evaluate(expression, returnType, variableResolver, functionMapper);
    } catch (ELException e) {
        LOG.debug("Error valuating EL '{}': {}", expression, e.toString(), e);
        Throwable t = e;
        if (e.getRootCause() != null) {
            t = e.getRootCause();
        }
        throw new ELEvalException(CommonError.CMN_0104, expression, t.toString(), e);
    }
}