json-logic-java
json-logic-java copied to clipboard
Can't evaluate single text parameter
Since the TextNode from the jackson library implements the iterable interface the isEligible method of ArrayLike returns true for that type of parameter. This can cause issues if the only parameter of an unary function is a string. In PreEvaluatedArgumentsExpression.evaluate, there is this piece of code:
if (values.size() == 1 && ArrayLike.isEligible(values.get(0))) {
values = new ArrayLike(values.get(0));
}
This will try to turn any TextNode into an ArrayLike using it's iterator() method. According to the jackson documentation, that will call the elements() method, which in turn returns an empty iterator, so at the end the result will be an empty ArrayLike object.