Example usage for org.apache.commons.jexl3 JexlException printStackTrace

List of usage examples for org.apache.commons.jexl3 JexlException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.jexl3 JexlException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.everit.expression.mvel.tests.JexlExpressionTest.java

@Test
public void testExceptionDuringEvaluation() {
    JexlExpressionCompiler compiler = new JexlExpressionCompiler();
    ParserConfiguration parserContext = new ParserConfiguration(this.getClass().getClassLoader());

    parserContext.setStartColumn(11);/*from  w w  w  .ja va 2  s. c om*/
    parserContext.setStartRow(21);
    parserContext.setName("exceptionDuringEvaluationExpr");

    String testExpression = " \n   a.substring(-1)";
    CompiledExpression compiledExpression = compiler.compile(testExpression, parserContext);
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("a", "test");
    try {
        compiledExpression.eval(vars);
        Assert.fail("Exception should have been thrown");
    } catch (JexlException e) {
        e.printStackTrace();
        // TODO
    }
}

From source file:org.everit.expression.mvel.tests.JexlExpressionTest.java

@Test
public void testExceptionOnCompilation() {
    JexlExpressionCompiler compiler = new JexlExpressionCompiler();
    ParserConfiguration parserContext = new ParserConfiguration(this.getClass().getClassLoader());

    parserContext.setStartColumn(11);/*  w  ww.j av a 2s .com*/
    parserContext.setStartRow(21);
    parserContext.setName("exceptionOnCompilationExpr");

    String testExpression = " \n  ...xx()";

    try {
        compiler.compile(testExpression, parserContext);
        Assert.fail("Exception should have been thrown");
    } catch (JexlException e) {
        e.printStackTrace();
        // TODO
    }

}