You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2012/07/06 16:59:33 UTC
[jira] [Resolved] (XERCESJ-1567) ArrayIndexOutOfBoundsException in
XSConstraints
[ https://issues.apache.org/jira/browse/XERCESJ-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich resolved XERCESJ-1567.
-------------------------------------------
Resolution: Fixed
Thanks for reporting. I've committed a fix to SVN. See revision 1358250.
> ArrayIndexOutOfBoundsException in XSConstraints
> -----------------------------------------------
>
> Key: XERCESJ-1567
> URL: https://issues.apache.org/jira/browse/XERCESJ-1567
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.0 Structures, XML Schema 1.1 Structures
> Affects Versions: 2.11.0
> Reporter: Radu Coravu
> Assignee: Michael Glavassevich
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I'm integrating "Xerces-J 2.11.0-xml-schema-1.1-beta" in Oxygen XML Editor.
> After the integration one of our automated tests caught this ArrayIndexOutOfBoundsException:
> ------------------------
> java.lang.ArrayIndexOutOfBoundsException: 2
> at org.apache.xerces.impl.xs.XSConstraints.overlapUPA(XSConstraints.java:610)
> at org.apache.xerces.impl.xs.XSConstraints.overlapUPA(XSConstraints.java:639)
> at org.apache.xerces.impl.xs.models.XSAllCM.checkUniqueParticleAttribution(Unknown Source)
> at org.apache.xerces.impl.xs.XSConstraints.fullSchemaChecking(XSConstraints.java:481)
> at org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.handleEndElement(XMLSchemaValidatorXerces.java:2568)
> at org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.endElement(XMLSchemaValidatorXerces.java:922)
> at com.thaiopensource.validate.xerces.ValidatorImpl.endElement(ValidatorImpl.java:186)
> at com.thaiopensource.validate.nvdl.ValidatorImpl.endElement(ValidatorImpl.java:719)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> --------------------------------------------------
> the code where this happens is like:
> ------------------------------------
> // or if the 2 substitution groups overlap.
> for (int i = subGroup1.length-1; i >= 0; i--) {
> for (int j = subGroup2.length-1; j >= 0; j--) {
> if (subGroup1[i].fName == subGroup2[i].fName &&
> subGroup1[i].fTargetNamespace == subGroup2[i].fTargetNamespace) {
> return true;
> }
> }
> }
> --------------------------------------
> So there are two "for" loops but the index in the first loop is used in both array entries which are compared.
> The code should probably use the "j" index in the second array like:
> --------------------------------------
> // or if the 2 substitution groups overlap.
> for (int i = subGroup1.length-1; i >= 0; i--) {
> for (int j = subGroup2.length-1; j >= 0; j--) {
> //OXYGEN PATCH, correctly use index when comparing
> if (subGroup1[i].fName == subGroup2[j].fName &&
> subGroup1[i].fTargetNamespace == subGroup2[j].fTargetNamespace) {
> return true;
> }
> }
> }
> -----------------------------------------
> Unfortunately I do not have a simple test for this, we had an automated test which validated an XML document against the OOXML XML Schemas available in an Oxygen installation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org