This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 127032 - Cannot validate XPath axis "descendant-or-self"
Summary: Cannot validate XPath axis "descendant-or-self"
Status: RESOLVED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: BPEL Validation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Vladimir Yaroslavskiy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-08 23:23 UTC by rpollack
Modified: 2008-03-04 15:19 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
BPEL that reproduces the problem (645 bytes, text/plain)
2008-02-08 23:25 UTC, rpollack
Details
Stack trace (3.30 KB, text/plain)
2008-02-08 23:26 UTC, rpollack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rpollack 2008-02-08 23:23:05 UTC
When validating a BPEL expression that contains an XPath expression containing "//", NetBeans blows up with the message
"java.lang.AssertionError: The index of axis 13 is out of possible values" (full stack trace attached, if I can figure
out how).  To reproduce the problem, have your BPEL contain an expression such as "$var1//foo" (a complete BPEL test
case is attached).

The problem is that the class org.netbeans.modules.xml.xpath.ext.impl.LocationStepImpl cannot deal with the XPath axis
named "descendant-or-self", usually abbreviated "//". The reason for this is that the XPath compiler (see
http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/Compiler.java?view=markup)
sends this axis as an integer, which the validator believes (incorrectly) is out of bounds.

The validator (see
http://deadlock.netbeans.org/fisheye/browse/~raw,r=1.2/netbeans/xml/xpath/ext/src/org/netbeans/modules/xml/xpath/ext/impl/LocationStepImpl.java)
contains the following code:

       assert axis < int2Axis.length : "The index of axis " + axis + " is out of possible values"; // NOI18N
        setAxis(int2Axis[axis - 1]);

This is the assertion that is failing, but this assertion is wrong. As you can see from the following statement, the
author knows that the incoming axis numbers start with 1. This means that the maximum legal value is int2Axis.length; so
the assertion should say "<=", not "<". As it happens, descendant-or-self is the value that the assertion incorrectly
excludes.

Incidentally, besides this assertion error, the class does not declare the XPath axes in the same order as the compiler.
This may cause other problems.

My workaround for this problem was to change from "//" to "/descendant::", since that was suitable for my needs.
Changing it to "descendant-or-self::" won't work, since it bumps into the same bug. If you really need this, you have to
write a Boolean expression.
Comment 1 rpollack 2008-02-08 23:25:03 UTC
Created attachment 56365 [details]
BPEL that reproduces the problem
Comment 2 rpollack 2008-02-08 23:26:34 UTC
Created attachment 56367 [details]
Stack trace
Comment 3 Vladimir Yaroslavskiy 2008-03-04 15:19:39 UTC
fixed.