Marcel,
Could you post the actual code and exception stack trace? (sorry, I
am tired at the end of the day and can't make sense of what you
wrote). BTW, this unit test works:
public void testMatchAllExp() throws Exception {
// create expressions and check the counts,
// leaf count should be (2N) : 2 leafs for each pair
// node count should be (2N + 1) for nodes with more than 1
pair
// and 2N for a single pair : 2 nodes for each pair + 1 list
node
// where N is map size
// check for N in (1..3)
for (int n = 1; n <= 3; n++) {
Map map = new HashMap();
// populate map
for (int i = 1; i <= n; i++) {
map.put("k" + i, "v" + i);
}
Expression exp = ExpressionFactory.matchAllExp(map,
Expression.LESS_THAN);
assertNotNull(exp);
handler.traverseExpression(exp);
// assert statistics
handler.assertConsistency();
assertEquals("Failed: " + exp, 2 * n, handler.getLeafs());
assertEquals("Failed: " + exp, n < 2 ? 2 * n : 2 * n +
1, handler
.getNodeCount());
}
}
On Jul 24, 2006, at 9:38 PM, Marcel wrote:
>
> As far as I can tell there is a bug in
> ExpressionFactory.*matchAllExp*(java.util.Map map, int type).
>
> With a map of keys and values, an exception will always arise here:
>
> Thread [main] (Suspended) ASTAnd
> (AggregateConditionNode).jjtAddChild(Node, int) line: 120
> ASTAnd(SimpleNode).setOperand(int, Object) line: 187
> ExpressionFactory.matchAllExp(Map, int) line: 298
>
> jjtAddChild throws an exception whenNode is not of type
> ConditionNode or AggregateConditionNode. However, the Node
> parameter is just the Object parameter from setOperand, which is
> called from matchAllExp as:
>
> exp.setOperand(0, new ASTObjPath(entry.getKey()));
>
> Where entry.getKey() is the object path (in my case just the name
> of an object attribute). ASTObjPath is not of the correct type, so
> an exception is thrown everytime, regardless of what entry.getKey()
> happens to be.
>
> Folks with more experience? I'll try just stringing my own
> expression together for now.
>
> Marcel
>
This archive was generated by hypermail 2.0.0 : Mon Jul 24 2006 - 22:18:09 EDT