commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Pham <>
Subject XPath getValue("//item") for Map throws StackOverflowException
Date Thu, 22 Mar 2007 18:16:37 GMT
Anyone see this problem before?
The test code is this:

    public void testXPath()
        List main = new ArrayList();
        ArrayList list = new ArrayList();
        Map map1 = new HashMap();
        map1.put("a", "TEST1");
        map1.put("b", "TEST2");
        JXPathContext context  = JXPathContext.newContext(main); // passed when replace main
with map1
        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"));

This test run will throw StackOverflowError with

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

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message