package org.wmaop.util.jexl;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlEngine;
import org.wmaop.util.jexl.functions.ArraysFunction;

public class JexlExpressionFactory {
	private static final JexlEngine jexlEngine = new JexlEngine();

	static {
		jexlEngine.setCache(512);
		jexlEngine.setLenient(true);
		jexlEngine.setSilent(false);

		Map<String, Object> funcs = new HashMap<>();
		funcs.put("arrays", new ArraysFunction());

		jexlEngine.setFunctions(funcs);
	}

	public static Expression createExpression(String expr) {
		return jexlEngine.createExpression(ExpressionProcessor.escapedToEncoded(expr));
	}


	public static JexlEngine getEngine() {
		return jexlEngine;
	}
}

@@ -261,16 +261,19 @@
 tory %7B%0D%0A
+%09%0D%0A
 %09private
@@ -570,24 +570,63 @@
 cs);%0D%0A%09%7D%0D%0A%0D%0A
+%09private JexlExpressionFactory() %7B%7D%0D%0A%0D%0A
 %09public stat

Tidy code