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 148419

Summary: Validation error message appears for correct XPath expression in query of property alias
Product: soa Reporter: _ alexpetrov <alexpetrov>
Component: BPEL ValidationAssignee: Nikita Krjukov <supernikita>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Project
screenshot
This diff shold to be applied to release61_fixes
The same as diff but in the hg export patch form

Description _ alexpetrov 2008-09-25 19:46:27 UTC
1. Unzip the attached project "LeadWebService".
   Start NB 6.1 or Sierra and open this project.
2. Open the file "leadBPEL.bpel".
   In the BPEL diagram right click on the activity "Invoke2" and select the popup menu item "Define Correlation..."
3. In the appeared dialog click the button "Next".
4. In the left tree expand the node "LeadCoreInfo".
   In the right tree expand the node "LeadDetailedInfo" and then its subnode "LeadCoreInfo".
5. Link the left tree node "LeadCoreInfo/AutoID" to the right tree node "LeadDetailedInfo/LeadCoreInfo/AutoID".
   Click "Finish".
6. Open the file "WizardCorrelationProperties.wsdl". 
   Switch to its "Source", click the toolbar button "Validate XML".

Result (see the attached screenshot): the following error message will appear
ERROR: The first step has to be "ns0:LeadCoreInfo", if an absolute path is used for query. Expression:
"/ns0:LeadCoreInfo/ns0:AutoID",
though the mentioned XPath expression of the appropriate query starts with "ns0:LeadCoreInfo" exactly.


This bug is reproduced on NB 6.1 and Sierra (soa-dev), but it's not reproduced on NB 6.5 trunk.

The reason is:

The module "WSDL Model Extensions" (xml.wsdl.extensions) contains the class "PathValidatorVisitor" and this class
contains the method "checkFirstStepType", which is used for validation and produces an error message (NB 6.1 and Sierra
only).
This method contains the folowing java code (important lines are marked by "==>"):
        Set<SchemaCompPair> scPairSet = null;
        LocationStep[] stepArr = locationPath.getSteps();
        if (stepArr != null && stepArr.length != 0) {
            LocationStep firstStep = stepArr[0];
            if (firstStep != null) {
==>             XPathSchemaContext sContext = firstStep.getSchemaContext();
                if (sContext != null) {
                    scPairSet = sContext.getSchemaCompPairs();
                }
            }
        }
        ............................................................
==>     if (scPairSet.size() == 1) {
        .............................
        }

Classes "LocationStep", "SchemaCompPair", "XPathSchemaContext", "MultiCompSchemaContext", "SimpleSchemaContext" are
contained in the module "Enterprise XPath" (xml.xpath.ext).

FOR NB 6.1 and SIERRA:
----------------------
"XPathSchemaContext sContext = firstStep.getSchemaContext();" returns an instance of the class "MultiCompSchemaContext"
for the LEFT XPath expression "/ns0:LeadCoreInfo/ns0:AutoID".
Then "scPairSet = sContext.getSchemaCompPairs();" and "scPairSet.size()" returns a value 2, which causes an error message.

For the RIGHT XPath expression "/ns0:LeadDetailedInfo/ns0:LeadCoreInfo/ns0:AutoID" a statement "XPathSchemaContext
sContext = firstStep.getSchemaContext();" gives an instance of the class "SimpleSchemaContext". "scPairSet.size()"
returns a value 1 and no new error message is produced.

FOR NB 6.5:
-----------
A statement "XPathSchemaContext sContext = firstStep.getSchemaContext();" gives an instance of the class
"SimpleSchemaContext" in both cases: for the LEFT XPath expression "/ns0:LeadCoreInfo/ns0:AutoID" and for the RIGHT
XPath expression "/ns0:LeadDetailedInfo/ns0:LeadCoreInfo/ns0:AutoID". 
"scPairSet.size()" returns a value 1 in both cases and error messages don't appear at all.
Comment 1 _ alexpetrov 2008-09-25 19:47:46 UTC
Created attachment 70619 [details]
Project
Comment 2 _ alexpetrov 2008-09-25 19:48:22 UTC
Created attachment 70620 [details]
screenshot
Comment 3 Vladimir Yaroslavskiy 2008-10-02 14:06:46 UTC
The problem is that module xml.wsdl.extensions (which comes from NetBeans 6.1 patch 3 binary) has dependency to
xml.xpath.ext module and uses it. The real cause of problem is xml.xpath.ext (it is old version from NetBeans 6.1), the
issue was fixed in new version of the module xml.xpath.ext01. So, there are one of the two ways:

1. to clone xml.xml.wsdl.extensions from release61_fixes to soa-dev and change dependency to xml.xpath.ext01
2. apply fix in xml.xpath.ext in release61_fixes and wait NetBeans 6.1 patch 4
Comment 4 Sergey Lunegov 2008-10-02 14:51:03 UTC
Fixed in NB 6.5.
Comment 5 pgebauer 2008-10-02 18:14:14 UTC
Since the issue has been resolved in the trunk as a part of large code refactoring, the regression doesn't impend and so
the issue could be fixed in the release61_fixes branch as part of 61patch4. Could you please provide a diff of proposed
changes in the attachment? Also QE's explanation "how safe the change is" should be filled in the description.
Comment 6 Nikita Krjukov 2008-10-02 18:29:50 UTC
Created attachment 71064 [details]
This diff shold to be applied to release61_fixes
Comment 7 Nikita Krjukov 2008-10-02 18:30:51 UTC
Created attachment 71065 [details]
The same as diff but in the hg export patch form
Comment 8 Andrei Chistiakov 2008-10-03 13:26:26 UTC
The issue is quite serious and would better be fixed in Patch 4. I can't say how safe the fix is and suggest to rely on
developer's opinion on that.
Comment 9 pgebauer 2008-10-03 15:34:54 UTC
The issue has been fixed in the release61_fixes branch:

http://hg.netbeans.org/release61_fixes/rev/329ed29f51e6
Comment 10 ggenipudi 2008-10-07 20:36:29 UTC
tested and verified using NetBeans IDE 6.1 Full distribution and
http://bits.netbeans.org/netbeans/6.1/fixes/2008-10-03_19-45-23/uc/catalog.xml.gz and followed the steps below and was
able to create correlation from "LeadCoreInfo/AutoID" to the right tree node "LeadDetailedInfo/LeadCoreInfo/AutoID".
 and did not see any errors during BPEL validate and "WizardCorrelationProperties.wsdl" validate.
Comment 11 pgebauer 2008-10-08 17:17:24 UTC
Marked as VERIFIED based on the comment above.