For anyone interested, I've worked around the problem below by using Saxon
instead of XQRL
Thanks, Paul
Paul Hepworth wrote:
>
>
Hi
>
I'm getting an AssertionError when calling toNextSelection on a cursor. The
code is in a custom tag used on a JSP, and works happily for the rest of the
application. However, on one instance, we get the AssertionError.
>
My code does the following:
>
> XmlCursor cursor = xmlObject.newCursor();
> try {
> cursor.selectPath(XmlBeanUtils.getNamespaceDeclaration() +
> "descendant-or-self::" + xPath);
> if (cursor.toNextSelection()) {
> ....
> }
> } finally {
> cursor.dispose();
> }
>
>
The application is running on Weblogic 9.2 using XmlBeans 2.3.0
>
The top of the error stack is as follows: (I can't post a full stack due to
network security reasons so I have to type this by hand)
>
> java.lang.AssertionError
> at org.apache.xmlbeans.impl.store.Cur.moveTo(Cur.java:442)
> at org.apache.xmlbeans.impl.store.Cur.next(Cur.java:1479)
> at org.apache.xmlbeans.impl.store.Cursor._toNextToken(Cursor.java:373)
> at
> org.apache.xmlbeans.impl.store.TokenIteratorImpl._fetchNext(TokenIteratorImpl.java:155)
> at
> org.apache.xmlbeans.impl.store.TokenIteratorImpl.fetchNext(TokenIteratorImpl.java:99)
> at
> weblogic.xml.query.iterators.GenericIterator.hasNext(GenericIterator.java:134)
> ...
> at
> org.apache.xmlbeans.impl.store.XqrlImpl$XqrlPathEngine.nextToken(XqrlImpl.java:124)
> at
> org.apache.xmlbeans.impl.store.XqrlImpl$XqrlPathEngine.next(XqrlImpl.java:142)
> ...
> at
> org.apache.xmlbeans.impl.store.Cursor.toNextSelection(Cursor.java:2670)
>
>
>
As a workaround, we can call toNextSelection, catch the AssertionError, and
then call toNextSelection again which then works.
>
>
>From initial inspection, it appears that the Cursor is not in the correct
state (REGISTERED or EMBEDDED) but is instead POOLED.
>
>
>From debugging, it starts in the correct state, and after numerous passes of
line 442, the state eventually goes to POOLED and hence the AssertionError
is thrown.
>
>
I'm guessing this is a bug internal to XmlBeans?
>
Any ideas much appreciated!
>
Thanks, Paul
>
--
View this message in context:
http://www.nabble.com/AssertionError-on-toNextSelection-tp18960799p19064575.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.