I think I found the problem. It is in
org.apache.xpath.axes.UnionPathIterator.runInto(int index). There is an
infinite loop caused by my test case, because we head into the first while
loop, the value of n is 4194311, and the loop never exits. Perhaps it needs
a check like the seond while loop in the method.
public void runTo(int index)
{
if (m_foundLast || ((index >= 0) && (index <= getCurrentPos())))
return;
int n;
if (-1 == index)
{
while (DTM.NULL != (n = nextNode())); <==== TEST CASE CAUSED
INFINITE LOOP HERE
}
else
{
while (DTM.NULL != (n = nextNode()))
{
if (getCurrentPos() >= index)
break;
}
}
}
> -----Original Message-----
> From: Mike Starr
> Sent: Thursday, August 16, 2001 6:43 PM
> To: Niranjan Kundapur
> Subject: RE: Xalan-J 2_2_D9 Bug -- XPathAPI.selectNodeList hangs
>
>
> sure
>
> > -----Original Message-----
> > From: Niranjan Kundapur
> > Sent: Thursday, August 16, 2001 6:29 PM
> > To: Mike Starr
> > Subject: RE: Xalan-J 2_2_D9 Bug -- XPathAPI.selectNodeList hangs
> >
> >
> > Meanwhile, shall we continue to use D6?
> > D6 does not transform a2wml as expected, but it does not
> > cause the hang.
> >
> > -----Original Message-----
> > From: Mike Starr
> > Sent: Thursday, August 16, 2001 6:10 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: Xalan-J 2_2_D9 Bug -- XPathAPI.selectNodeList hangs
> >
> >
> > This worked with Xalan 2_2_D6 and hangs in 2_2_D9. The
> > problem is centered around the "branch[2]" part of the XPath
> > expression. Seems that if the number of branch elements in
> > the test case is equal to or greater than the XPath qualifier
> > number, selectNodeList hangs. Otherwise it returns correctly.
> > For example, if I comment out the second branch element, it
> > does not hang and returns the NodeList.
> >
> > -Mike
> >
> > My sample xml file:
> >
> > <?xml version="1.0" ?>
> > <a2wml version="2.0">
> > <card id="b">
> > <prompt>
> > this is a prompt
> > </prompt>
> > <branch target="#c" label="c"/>
> > <branch target="#f" type="options" label="f"/>
> > </card>
> > </a2wml>
> >
> >
> > My java code:
> >
> > public static void main(String args[])
> > {
> >
> > try
> > {
> > //parse test case
> > DocumentBuilderFactory dbf =
> > DocumentBuilderFactory.newInstance();
> > dbf.setValidating(false);
> > DocumentBuilder db = dbf.newDocumentBuilder();
> > InputSource in = new InputSource(new
> FileReader(args[0]));
> > Document doc = db.parse(in);
> >
> > //make the card the context node
> > Node ctx = doc.getElementsByTagName("card").item(0);
> >
> > NodeList nl = XPathAPI.selectNodeList (ctx,
> > "prompt | branch[2]");
> > System.out.println("nodelist.length:" + nl.getLength());
> > } catch (Exception e)
> > {
> > e.printStackTrace();
> > }
> >
> > }
> >
>