Search in sources :

Example 1 with ExpressionBuilder

use of org.jboss.el.lang.ExpressionBuilder in project sonar-web by SonarSource.

the class UnifiedExpressionCheck method validateExpression.

private void validateExpression(TagNode element, Attribute attribute) {
    ExpressionLanguageContext context = new ExpressionLanguageContext(element);
    ExpressionBuilder builder = new ExpressionBuilder(attribute.getValue(), context);
    try {
        builder.createValueExpression(Object.class);
    } catch (ELException e) {
        if (e.getMessage().startsWith("Error")) {
            createViolation(element.getStartLinePosition(), "Fix this expression: " + (e.getMessage() == null ? "" : e.getMessage()));
        }
    }
}
Also used : ELException(javax.el.ELException) ExpressionBuilder(org.jboss.el.lang.ExpressionBuilder)

Example 2 with ExpressionBuilder

use of org.jboss.el.lang.ExpressionBuilder in project sonar-web by SonarSource.

the class UnifiedExpressionCheck method validateExpression.

private void validateExpression(TagNode element, Attribute attribute) {
    ExpressionLanguageContext context = new ExpressionLanguageContext(element);
    ExpressionBuilder builder = new ExpressionBuilder(attribute.getValue(), context);
    try {
        builder.createValueExpression(Object.class);
    } catch (ELException e) {
        if (e.getMessage().startsWith("Error")) {
            createViolation(element.getStartLinePosition(), "Fix this expression: " + (e.getMessage() == null ? "" : e.getMessage()));
        }
    }
}
Also used : ELException(javax.el.ELException) ExpressionBuilder(org.jboss.el.lang.ExpressionBuilder)

Aggregations

ELException (javax.el.ELException)2 ExpressionBuilder (org.jboss.el.lang.ExpressionBuilder)2