commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: XPath getValue("//item") for Map throws StackOverflowException
Date Thu, 22 Mar 2007 21:20:28 GMT
Are you using version 1.2?  This test passes for me in
HEAD, so if you are using the release, it's probably a
bug that has been fixed in the interim.  Be on the
lookout for a new release in the next month or two; of
course you can use HEAD yourself as well.

HTH,
Matt

--- Tim Pham <tim_ph@yahoo.com> wrote:

> 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.
> 
> 
> 
> 
> 



 
____________________________________________________________________________________
Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message