commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Heaberlin <heabd...@gmail.com>
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:
Vector
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)

Vector
    [1] Hashtable
           KeyOne="SomeStringOne"
           KeyTwo="SomeStringTwo"
           KeyThree=Hashtable
                    KeyA="StringA"
                    KeyB="StringB"
                    KeyC="StringC" ... etc
    [2] Array
        [1]
        [2]
        [3]...etc


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

.[1]/KeyOne
.[1]KeyTwo

I have no problems - this works as expected.

When I do a getValue() using 

.[1]/KeyThree/KeyA

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

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

java.lang.StackOverflowError
        at org.apache.commons.jxpath.ri.model.beans.CollectionPointer.getValuePointer(CollectionPointer.java:98)
        at org.apache.commons.jxpath.ri.model.beans.CollectionPointer.testNode(CollectionPointer.java:202)
        at org.apache.commons.jxpath.ri.model.beans.CollectionPointer.testNode(CollectionPointer.java:202)
...

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:
.[1]/KeyThree/*
.[1]/KeyThree//
.[1]/KeyThree/

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


Scott Heaberlin

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