Anyone see this problem before?
The test code is this:
<pre>
public void testXPath()
{
List main = new ArrayList();
ArrayList list = new ArrayList();
main.add(list);
Map map1 = new HashMap();
map1.put("a", "TEST1");
map1.put("b", "TEST2");
main.add(map1);
JXPathContext context = JXPathContext.newContext(main); // passed when
replace main with map1
context.setLenient(true);
assertEquals("value is not right", "TEST1", context.getValue("//a"));
assertEquals("value is not right", "TEST2", context.getValue("//b"));
assertEquals("value is not right", null, context.getValue("//c"));
}
</pre>
This test run will throw StackOverflowError with
org.apache.common.jxpath.model.beans.CollectionPointer(CollectionPointer.java):202
In reality, main is my bean with HashMap attributes that can contain other
attributes. When using JXPath to provide a uniform way to access my bean
attributes, I stumple on this problem. getValue("//not-exist") didn't return
null as expected but go into a loop that consumes all memory.