@SuppressWarnings("rawtypes") protected Object doEvaluate(String expression, Class expectedType, javax.servlet.jsp.el.FunctionMapper functionMapper) throws javax.servlet.jsp.el.ELException { try { return ExpressionEvaluatorManager.evaluate("JSP EL expression", expression, expectedType, this.pageContext); } catch (JspException ex) { throw new javax.servlet.jsp.el.ELException("Parsing of JSP EL expression \"" + expression + "\" failed", ex); } }
@Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { return this.variableResolver.resolveVariable(property .toString()); } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getValue(context, base, property); } return null; }
} catch (ELException e) { throw new SCXMLExpressionException("eval('" + expr + "'):" + e.getMessage(), e);
/** * Returns the root cause of the exception. */ public Throwable getRootCause() { return getCause(); } }
/** * Evaluate an EL expression. <p> * * @param <T> the return type of the expression * @param expr EL expression to evaluate. * @param clazz return type of the EL expression. * @return the object the EL expression evaluated to. * @throws Exception thrown if an EL function failed due to a transient error or EL expression could not be * evaluated. */ @SuppressWarnings({"unchecked", "deprecation"}) public <T> T evaluate(String expr, Class<T> clazz) throws Exception { ELEvaluator existing = current.get(); try { current.set(this); return (T) evaluator.evaluate(expr, clazz, context, context); } catch (ELException ex) { if (ex.getRootCause() instanceof Exception) { throw (Exception) ex.getRootCause(); } else { throw ex; } } finally { current.set(existing); } }
@Override public Class<?> getType(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { Object obj = this.variableResolver.resolveVariable(property .toString()); return (obj != null) ? obj.getClass() : null; } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getType(context, base, property); } return null; }
/** * @see Evaluator#evalCond(Context, String) */ public Boolean evalCond(final Context ctx, final String expr) throws SCXMLExpressionException { if (expr == null) { return null; } VariableResolver vr = null; if (ctx instanceof VariableResolver) { vr = (VariableResolver) ctx; } else { vr = new ContextWrapper(ctx); } try { String evalExpr = inFct.matcher(expr). replaceAll("In(_ALL_STATES, "); evalExpr = dataFct.matcher(evalExpr). replaceAll("Data(_ALL_NAMESPACES, "); Boolean rslt = (Boolean) getEvaluator().evaluate(evalExpr, Boolean.class, vr, builtinFnMapper); if (log.isDebugEnabled()) { log.debug(expr + " = " + String.valueOf(rslt)); } return rslt; } catch (ELException e) { throw new SCXMLExpressionException("eval('" + expr + "'):" + e.getMessage(), e); } }
/** * Returns the root cause. * * @return the root cause of this exception */ public Throwable getRootCause() { return getCause(); } }
/** * Evaluate an EL expression. <p> * * @param <T> the return type of the expression * @param expr EL expression to evaluate. * @param clazz return type of the EL expression. * @return the object the EL expression evaluated to. * @throws Exception thrown if an EL function failed due to a transient error or EL expression could not be * evaluated. */ @SuppressWarnings({"unchecked", "deprecation"}) public <T> T evaluate(String expr, Class<T> clazz) throws Exception { ELEvaluator existing = current.get(); try { current.set(this); return (T) evaluator.evaluate(expr, clazz, context, context); } catch (ELException ex) { if (ex.getRootCause() instanceof Exception) { throw (Exception) ex.getRootCause(); } else { throw ex; } } finally { current.set(existing); } }
@SuppressWarnings("rawtypes") protected Object doEvaluate(String expression, Class expectedType, javax.servlet.jsp.el.FunctionMapper functionMapper) throws javax.servlet.jsp.el.ELException { try { return ExpressionEvaluatorManager.evaluate("JSP EL expression", expression, expectedType, this.pageContext); } catch (JspException ex) { throw new javax.servlet.jsp.el.ELException("Parsing of JSP EL expression \"" + expression + "\" failed", ex); } }
@Override public Class<?> getType(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException(); } if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { Object obj = this.variableResolver.resolveVariable(property .toString()); return (obj != null) ? obj.getClass() : null; } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getType(context, base, property); } return null; }
/** * Get the value of the given variable in this Context. * * @param name The name of the variable * @return The value (or null) * @see org.apache.commons.scxml.Context#get(java.lang.String) */ public Object get(final String name) { Object value = super.get(name); if (value == null) { try { value = variableResolver.resolveVariable(name); } catch (ELException ele) { getLog().error(ele.getMessage(), ele); } } return value; }
/** * Returns the root cause. * * @return the root cause of this exception */ public Throwable getRootCause() { return getCause(); } }
if (ex.getRootCause() instanceof Exception) { throw (Exception) ex.getRootCause();
public static ELException create(Throwable e) { if (e instanceof ELException) return (ELException) e; else return new ELException(e); } }
@Override public Class<?> getType(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { if (context == null) { throw new NullPointerException(); } if (base == null) { context.setPropertyResolved(true); if (property != null) { try { Object obj = this.variableResolver.resolveVariable(property .toString()); return (obj != null) ? obj.getClass() : null; } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getType(context, base, property); } return null; }
} catch (ELException e) { throw new SCXMLExpressionException("eval('" + expr + "'):" + e.getMessage(), e);
rootCause = ((JspException) t).getCause(); } else if (t instanceof ELException) { rootCause = ((ELException) t).getCause();
if (ex.getRootCause() instanceof Exception) { throw (Exception) ex.getRootCause();
public Object evaluate(String expression, Class expectedType, VariableResolver resolver, FunctionMapper mapper) throws ELException { Object object = expressions.get(expression); if(null == object) { throw new ELException("No object for expression " + expression + " defined."); } if(!object.getClass().equals(expectedType)) { throw new ELException("Expected type " + expectedType + " for expression " + expression + " but actual type is " + object.getClass()); } return object; }