Example usage for org.springframework.expression EvaluationException EvaluationException

List of usage examples for org.springframework.expression EvaluationException EvaluationException

Introduction

In this page you can find the example usage for org.springframework.expression EvaluationException EvaluationException.

Prototype

public EvaluationException(String expressionString, String message) 

Source Link

Document

Create a new expression evaluation exception.

Usage

From source file:org.jasig.portlet.spring.SpringELProcessor.java

@Override
public String process(String value, PortletRequest request) {
    Map<String, Object> context = getContext(request);

    StandardEvaluationContext sec = new StandardEvaluationContext(context);
    sec.addPropertyAccessor(new MapAccessor());
    sec.addPropertyAccessor(new ReflectivePropertyAccessor());
    sec.addPropertyAccessor(new DefaultPropertyAccessor(PARSER_CONTEXT.getExpressionPrefix(),
            PARSER_CONTEXT.getExpressionSuffix()));
    if (beanResolver != null) {
        sec.setBeanResolver(beanResolver);
    }/*from   w ww .  j a  v a 2  s  .c  om*/
    SpelExpressionParser parser = new SpelExpressionParser();

    try {
        String processed = parser.parseExpression(value, PARSER_CONTEXT).getValue(sec, String.class);
        return processed;
    } catch (SpelEvaluationException e) {
        throw new EvaluationException("Failed to process string '" + value
                + "'. See nested error message and check your SpEL tokens in your string", e);
    }
}