[
https://issues.apache.org/jira/browse/XERCESJ-1628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13946486#comment-13946486
]
Octavian Nadolu commented on XERCESJ-1628:
------------------------------------------
If I run from the command line, on the latest codebase from xml-schema-1.1-dev
branch, with java 1.5, the folowing line:
jaxp.SourceValidator -xsd11 -a schema.xsd
I get the errors in the output:
{code}
[Error] schema.xsd:3:47: s4s-att-invalid-value: Invalid attribute value for
'maxVersion' in element 'schema'. Recorded reason: null
[Error] schema.xsd:3:47: s4s-att-invalid-value: Invalid attribute value for
'minVersion' in element 'schema'. Recorded reason: null {code}
If you look at the the errors stack trace, at the following line
SchemaDOMParser.checkVersionControlAttributes(SchemaDOMParser.java:644), you
can notice that in the SchemaDOMParser at line 644 a NumberFormatException is
catch and is reported as error. The problem is that from the
NumberFormatException has the messge null, and the message of the exception is
used by the fErrorReporter.reportError() method.
{code}
catch (NumberFormatException nfe) {
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
"s4s-att-invalid-value",
Object[] {element.localpart, attrLocalName, nfe.getMessage()},
XMLErrorReporter.SEVERITY_ERROR);
}
{code}
org.xml.sax.SAXParseException; systemId:
file:/E:/TestFiles/Bugs%20-%20Test%20Files/Xerces/schema.xsd; lineNumber: 3;
columnNumber: 47; s4s-att-invalid-value: Invalid attribute value for
'maxVersion' in element 'schema'. Recorded reason: null
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
at
org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
at
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
at
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:282)
at
org.apache.xerces.impl.xs.opti.SchemaDOMParser.checkVersionControlAttributes(SchemaDOMParser.java:644)
at
org.apache.xerces.impl.xs.opti.SchemaDOMParser.startElement(SchemaDOMParser.java:260)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at
org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:627)
at
org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:683)
at
org.apache.xerces.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:587)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2455)
at
org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:642)
{code}
> Error when inserting invalid characters in the value of the maxVersion or
> maxVersion attributes
> -----------------------------------------------------------------------------------------------
>
> Key: XERCESJ-1628
> URL: https://issues.apache.org/jira/browse/XERCESJ-1628
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.1 Structures
> Affects Versions: 2.11.0
> Reporter: Octavian Nadolu
> Priority: Trivial
>
> If I insert invalid characters in the value of the maxVersion or maxVersion
> attributes, Xerces reports an error with the reason "null".
> In the SchemaDOMParser, when the value of the attributes is parsed, a
> NumberFormatException is thrown, that has the message null. This message is
> then passed to the error reporter.
> I tested on the xml-schema-1.1-dev branch.
> --------- Schema.xsd -------------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
> vc:maxVersion="1.1s" vc:minVersion="1.0a"> </xs:schema>
> -----------------------------------------
> ---------- Error ------------------
> s4s-att-invalid-value: Invalid attribute value for 'minVersion' in element
> 'schema'. Recorded reason: null
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
> at
> org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
> at
> org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
> at
> org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
> at
> org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:282)
> at
> org.apache.xerces.impl.xs.opti.SchemaDOMParser.checkVersionControlAttributes(SchemaDOMParser.java:635)
> at
> org.apache.xerces.impl.xs.opti.SchemaDOMParser.startElement(SchemaDOMParser.java:260)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
> at
> org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:627)
> at
> org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:683)
> at
> org.apache.xerces.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:587)
> at
> org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2446)
> at
> org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:644)
> at
> org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
> at
> org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:611)
> at
> org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
> at
> org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
> at
> org.apache.xerces.jaxp.validation.XMLSchema11Factory.newSchema(XMLSchema11Factory.java:1)
> --------------------------------
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]