@Test public void evaluateWhenExpressionVarIsUndefined() { String expression = "dummy.intValue"; Map<String, Object> vars = new HashMap<>(); ExpressionEvaluator expressionEvaluator = new JexlExpressionEvaluatorNoThreadLocal(); Object result = expressionEvaluator.evaluate( expression, vars ); assertNull(result); }
@Override public Object evaluate(String expression, Map<String, Object> context) { JexlContext jexlContext = new MapContext(context); try { JexlExpression jexlExpression = expressionMap.get(expression); if (jexlExpression == null) { jexlExpression = jexl.createExpression(expression); expressionMap.put(expression, jexlExpression); } return jexlExpression.evaluate(jexlContext); } catch (Exception e) { throw new EvaluationException("An error occurred when evaluating expression " + expression, e); } }
JexlExpressionEvaluatorNoThreadLocal implements ExpressionEvaluator { @Override public Object evaluate(String expression, Map<String, Object> context) { JexlContext jexlContext = new MapContext(context); try { JexlExpression jexlExpression = expressionMap.get(expression); if (jexlExpression == null) { jexlExpression = jexl.createExpression(expression); expressionMap.put(expression, jexlExpression); } return jexlExpression.evaluate(jexlContext); } catch (Exception e) { throw new EvaluationException("An error occurred when evaluating expression " + expression, e); } } }
JexlExpressionEvaluatorNoThreadLocal implements ExpressionEvaluator { @Override public Object evaluate(String expression, Map<String, Object> context) { JexlContext jexlContext = new MapContext(context); try { JexlExpression jexlExpression = expressionMap.get(expression); if (jexlExpression == null) { jexlExpression = jexl.createExpression(expression); expressionMap.put(expression, jexlExpression); } return jexlExpression.evaluate(jexlContext); } catch (Exception e) { throw new EvaluationException("An error occurred when evaluating expression " + expression, e); } } JexlExpressionEvaluatorNoThreadLocal();  JexlExpressionEvaluatorNoThreadLocal(boolean silent, boolean strict);  JexlExpressionEvaluatorNoThreadLocal(String expression);  JexlExpressionEvaluatorNoThreadLocal(Map<String, Object> context);  JexlExpressionEvaluatorNoThreadLocal(JexlContext jexlContext); }
JexlExpressionEvaluatorNoThreadLocal implements ExpressionEvaluator { @Override public Object evaluate(String expression, Map<String, Object> context) { JexlContext jexlContext = new MapContext(context); try { JexlExpression jexlExpression = expressionMap.get(expression); if (jexlExpression == null) { jexlExpression = jexl.createExpression(expression); expressionMap.put(expression, jexlExpression); } return jexlExpression.evaluate(jexlContext); } catch (Exception e) { throw new EvaluationException("An error occurred when evaluating expression " + expression, e); } } JexlExpressionEvaluatorNoThreadLocal();  JexlExpressionEvaluatorNoThreadLocal(boolean silent, boolean strict);  JexlExpressionEvaluatorNoThreadLocal(String expression);  JexlExpressionEvaluatorNoThreadLocal(Map<String, Object> context);  JexlExpressionEvaluatorNoThreadLocal(JexlContext jexlContext); @Override Object evaluate(String expression, Map<String, Object> context); @Override Object evaluate(Map<String, Object> context); JexlExpression getJexlExpression(); void setJexlEngine(final JexlEngine jexlEngine); JexlEngine getJexlEngine(); @Override String getExpression(); }
JexlExpressionEvaluatorNoThreadLocal implements ExpressionEvaluator { @Override public Object evaluate(String expression, Map<String, Object> context) { JexlContext jexlContext = new MapContext(context); try { JexlExpression jexlExpression = expressionMap.get(expression); if (jexlExpression == null) { jexlExpression = jexl.createExpression(expression); expressionMap.put(expression, jexlExpression); } return jexlExpression.evaluate(jexlContext); } catch (Exception e) { throw new EvaluationException("An error occurred when evaluating expression " + expression, e); } } JexlExpressionEvaluatorNoThreadLocal();  JexlExpressionEvaluatorNoThreadLocal(boolean silent, boolean strict);  JexlExpressionEvaluatorNoThreadLocal(String expression);  JexlExpressionEvaluatorNoThreadLocal(Map<String, Object> context);  JexlExpressionEvaluatorNoThreadLocal(JexlContext jexlContext); @Override Object evaluate(String expression, Map<String, Object> context); @Override Object evaluate(Map<String, Object> context); JexlExpression getJexlExpression(); void setJexlEngine(final JexlEngine jexlEngine); JexlEngine getJexlEngine(); @Override String getExpression();  }