It appears that BshUtil.eval overwrites updates(but not inserts) to context
variables.
That did not seem right. It seemed more natural that pipeline processing of
events depend on context being set in previous actions. Wondering if this is a
bug and what the best fix could be.
See following code: First context key-value is copied into Bsh
'globalNamespace', eval done, and then variables copied from bsh
globalNamespace onto context, thereby overwriting any changes done to context
key-values inside the 'eval'.
BshUtil.java
public static final Object eval(String expression, Map<String, Object>
context) throws EvalError {
Interpreter bsh = makeInterpreter(context);
// evaluate the expression
o = bsh.eval(expression);
...
// read back the context info
NameSpace ns = bsh.getNameSpace();
String[] varNames = ns.getVariableNames();
for (String varName: varNames) {
context.put(varName, bsh.get(varName));
}
}
where
public static Interpreter makeInterpreter(Map<String, ? extends Object>
context) throws EvalError {
....
for (Map.Entry<String, ? extends Object> entry: context.entrySet())
{
bsh.set(entry.getKey(), entry.getValue());
}
..
return bsh;
}
thoughts ?
Harmeet