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: [email protected]
For additional commands, e-mail: [email protected]