commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Heaberlin <>
Subject [JXPATH] StackOverflowError with xpath to Map object
Date Thu, 17 Mar 2005 23:58:44 GMT
Hello JXPath users -

Preface:  I am using JXPath release 1.2
My object graph is as follows:
index[1]: Hashtable, 3 entries, all String keyed. For 2 of the entries
the value is another String; for  one key the value is another
Hashtable with its own String keyed values.
index[2]: Vector, not relevant for this message.

It somewhat looks as follows (I hope this looks ok in your email client)

    [1] Hashtable
                    KeyC="StringC" ... etc
    [2] Array

When I do a getValue() using the following xpaths:


I have no problems - this works as expected.

When I do a getValue() using 


I also have no problem - the result is "StringA"

When I do getValue() using ".[1]/KeyThree" I get a StackOverflowError.  

        at org.apache.commons.jxpath.ri.model.beans.CollectionPointer.getValuePointer(
        at org.apache.commons.jxpath.ri.model.beans.CollectionPointer.testNode(
        at org.apache.commons.jxpath.ri.model.beans.CollectionPointer.testNode(

I see dozens of lines following in the stack trace all at
CollectionPointer.testNode(). Lots.

It appears that when my xpath evaluates to a specific element in the
"KeyThree" hashtable, there is no problem.  Trying to reference the
actual "KeyThree" object itself always causes the problem.

Ultimately I'm trying to perform an xpath function "size()" to receive
the size of the inner Hashtable keyed in the outer hashtable by
"KeyThree".  I've tried different xpaths:

I've also tried writing my own static method and using xpath
"com.mypkg.MyClass.mapSize(.[1]/KeyThree)"  but I get the same result.
 During this approach I tried having the argument to my mapSize()
method be a Node, NodeSet, a Map, and finally ExpressionContext... but
in the debugger I never EVER make it to my method... the
StackOverflowError occurs before any breakpoints in my method.

Am I missing something?  Is there anyway I can either A) get a direct
reference to a non-empty hashtable in an object graph via xpath, or B)
write an xpath query that will cause JXPath to return me the size of
said hashtable?  I am unable to do either.

Thanks in advance for any help,



Scott Heaberlin

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message