[ 
https://issues.apache.org/jira/browse/XERCESJ-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875617#action_12875617
 ] 

George Bina commented on XERCESJ-832:
-------------------------------------

The problem is this code that starts at line 387:

                int j = 0;
                for(; j < i && ((fMatched[j] & MATCHED) != MATCHED); j++);
                if ((j < i) || (fMatched[j] == 0)) {
                    continue;
                }
As far as I can see this tries an optimization but it clearly fails to 
correctly set the state of the other location paths thus the wrong results. 
Removing this solves the problem. 

There is also an additional line that uses j instead of i that needs to be 
changed to have the class compilable, here it is a patch with all these changes:

Index: src/org/apache/xerces/impl/xs/identity/XPathMatcher.java
===================================================================
--- src/org/apache/xerces/impl/xs/identity/XPathMatcher.java    (revision 
950437)
+++ src/org/apache/xerces/impl/xs/identity/XPathMatcher.java    (working copy)
@@ -384,12 +384,7 @@
 
             // signal match, if appropriate
             else {
-                int j = 0;
-                for(; j < i && ((fMatched[j] & MATCHED) != MATCHED); j++);
-                if ((j < i) || (fMatched[j] == 0)) {
-                    continue;
-                }
-                if ((fMatched[j] & MATCHED_ATTRIBUTE) == MATCHED_ATTRIBUTE) {
+                if ((fMatched[i] & MATCHED_ATTRIBUTE) == MATCHED_ATTRIBUTE) {
                     fMatched[i] = 0;
                     continue;
                 }

Please note that I have a contributor agreement sent to Apache a few years ago 
(in case you have any concerns related with applying the patch).

> element order matters on keyref checking?
> -----------------------------------------
>
>                 Key: XERCESJ-832
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-832
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.5.0
>         Environment: Operating System: Other
> Platform: Other
>            Reporter: Jon Schewe
>            Assignee: Xerces-J Developers Mailing List
>         Attachments: 24724.patch, dome.xsd, test.xml, test.xml
>
>
> By reversing the order of the Entity tags RoleKeyRef will fail.  However to 
> get
> to this point in the validation the patch for bug 24692 needs to be applied
> first, otherwise the keys won't propertly be recognized.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to