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 "Vojtěch Toman (JIRA)" <xe...@xml.apache.org> on 2011/03/17 13:31:30 UTC

[jira] Created: (XERCESJ-1500) ArrayIndexOutOfBoundsException in SchemaGrammar

ArrayIndexOutOfBoundsException in SchemaGrammar
-----------------------------------------------

                 Key: XERCESJ-1500
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1500
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema API
    Affects Versions: 2.11.0
            Reporter: Vojtěch Toman


I got an ArrayIndexOutOfBoundsException in the SchemaGrammar(SchemaGrammar constructor):

...
// Groups being redefined by restriction
fRGCount = grammar.fRGCount;
if (fRGCount > 0) {
    fRedefinedGroupDecls = new XSGroupDecl[grammar.fRedefinedGroupDecls.length];
    fRGLocators = new SimpleLocator[grammar.fRGLocators.length];
    System.arraycopy(grammar.fRedefinedGroupDecls, 0, fRedefinedGroupDecls, 0, fRGCount);
    // HERE
    System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount);
}
...

The reason for the exception was that the size of both grammar.fRGLocators and fRGLocators was 2, but the value of fRGCount was 4.

It is relatively difficult do describe my setup, but I am basically doing the following:
- Validating a sequence of DITA documents using the same DOMParser instance
- The parser is using a custom grammar pool implementation

It all worked fine with Xerces 2.9.1, but not with Xerces 2.11.0 which introduced some new behavior in XMLSchemaValidator.findSchemaGrammar(). The problem is that if there are schemas in the grammar pool with a matching namespace, Xerces does not follow the schema location hints anymore unless the following feature is enabled:

http://apache.org/xml/features/namespace-growth

After enabling this feature, I got conflicts because of duplicate schemas, so I enabled also:

http://apache.org/xml/features/internal/tolerate-duplicates

However, that resulted in the ArrayIndexOutOfBoundsException described above.

--
This message is automatically generated by JIRA.
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


[jira] Resolved: (XERCESJ-1500) ArrayIndexOutOfBoundsException in SchemaGrammar

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich resolved XERCESJ-1500.
-------------------------------------------

    Resolution: Fixed

Thanks for reporting this issue. Khaled committed a fix on Thursday. See SVN rev 1082533 for the patch to the source.

> ArrayIndexOutOfBoundsException in SchemaGrammar
> -----------------------------------------------
>
>                 Key: XERCESJ-1500
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1500
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema API
>    Affects Versions: 2.11.0
>            Reporter: Vojtěch Toman
>            Assignee: Khaled Noaman
>
> I got an ArrayIndexOutOfBoundsException in the SchemaGrammar(SchemaGrammar constructor):
> ...
> // Groups being redefined by restriction
> fRGCount = grammar.fRGCount;
> if (fRGCount > 0) {
>     fRedefinedGroupDecls = new XSGroupDecl[grammar.fRedefinedGroupDecls.length];
>     fRGLocators = new SimpleLocator[grammar.fRGLocators.length];
>     System.arraycopy(grammar.fRedefinedGroupDecls, 0, fRedefinedGroupDecls, 0, fRGCount);
>     // HERE
>     System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount);
> }
> ...
> The reason for the exception was that the size of both grammar.fRGLocators and fRGLocators was 2, but the value of fRGCount was 4.
> It is relatively difficult do describe my setup, but I am basically doing the following:
> - Validating a sequence of DITA documents using the same DOMParser instance
> - The parser is using a custom grammar pool implementation
> It all worked fine with Xerces 2.9.1, but not with Xerces 2.11.0 which introduced some new behavior in XMLSchemaValidator.findSchemaGrammar(). The problem is that if there are schemas in the grammar pool with a matching namespace, Xerces does not follow the schema location hints anymore unless the following feature is enabled:
> http://apache.org/xml/features/namespace-growth
> After enabling this feature, I got conflicts because of duplicate schemas, so I enabled also:
> http://apache.org/xml/features/internal/tolerate-duplicates
> However, that resulted in the ArrayIndexOutOfBoundsException described above.

--
This message is automatically generated by JIRA.
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


[jira] Assigned: (XERCESJ-1500) ArrayIndexOutOfBoundsException in SchemaGrammar

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich reassigned XERCESJ-1500:
---------------------------------------------

    Assignee: Khaled Noaman

> ArrayIndexOutOfBoundsException in SchemaGrammar
> -----------------------------------------------
>
>                 Key: XERCESJ-1500
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1500
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema API
>    Affects Versions: 2.11.0
>            Reporter: Vojtěch Toman
>            Assignee: Khaled Noaman
>
> I got an ArrayIndexOutOfBoundsException in the SchemaGrammar(SchemaGrammar constructor):
> ...
> // Groups being redefined by restriction
> fRGCount = grammar.fRGCount;
> if (fRGCount > 0) {
>     fRedefinedGroupDecls = new XSGroupDecl[grammar.fRedefinedGroupDecls.length];
>     fRGLocators = new SimpleLocator[grammar.fRGLocators.length];
>     System.arraycopy(grammar.fRedefinedGroupDecls, 0, fRedefinedGroupDecls, 0, fRGCount);
>     // HERE
>     System.arraycopy(grammar.fRGLocators, 0, fRGLocators, 0, fRGCount);
> }
> ...
> The reason for the exception was that the size of both grammar.fRGLocators and fRGLocators was 2, but the value of fRGCount was 4.
> It is relatively difficult do describe my setup, but I am basically doing the following:
> - Validating a sequence of DITA documents using the same DOMParser instance
> - The parser is using a custom grammar pool implementation
> It all worked fine with Xerces 2.9.1, but not with Xerces 2.11.0 which introduced some new behavior in XMLSchemaValidator.findSchemaGrammar(). The problem is that if there are schemas in the grammar pool with a matching namespace, Xerces does not follow the schema location hints anymore unless the following feature is enabled:
> http://apache.org/xml/features/namespace-growth
> After enabling this feature, I got conflicts because of duplicate schemas, so I enabled also:
> http://apache.org/xml/features/internal/tolerate-duplicates
> However, that resulted in the ArrayIndexOutOfBoundsException described above.

--
This message is automatically generated by JIRA.
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