[
https://issues.apache.org/jira/browse/XERCESJ-1729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mukul Gandhi reassigned XERCESJ-1729:
-------------------------------------
Assignee: Mukul Gandhi
> combination of restrictions length and minLength leads to error
> ---------------------------------------------------------------
>
> Key: XERCESJ-1729
> URL: https://issues.apache.org/jira/browse/XERCESJ-1729
> Project: Xerces2-J
> Issue Type: Bug
> Components: JAXP (javax.xml.validation)
> Reporter: Puskai Zoltán
> Assignee: Mukul Gandhi
> Priority: Major
>
> If I have a restriction in an xsd file containing length and
> minLength(/maxLength) - I know it is redundant, but we got the xsd from
> another system.
> {quote}<xs:restriction base="xs:string">
> <xs:length value="11"/>
> <xs:minLength value="11"/>
> </xs:restriction>
> {quote}
> loading the file fails
> {quote}SchemaFactory sf = SchemaFactory.newDefaultInstance();
> Schema s = sf.newSchema(new File("...xsd"));
> {quote}
> The error is:
> length-minLength-maxLength.1.1: For type <TYPE>, it is an error for the value
> of length '-1' to be less than the value of minLength '11'.
>
> The problem seems to be in the file
> com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl lines 1169-1171
> {quote}{{if((fBase.fFacetsDefined & FACET_LENGTH) != 0 || (fFacetsDefined &
> FACET_LENGTH) != 0){}}
> {{ if ((fFacetsDefined & FACET_MINLENGTH) != 0){}}
> {{ if (fBase.fLength < fMinLength) {}}
> {quote}
> fBase.flength is -1, flength is 11, fMinlength is 11
> The length is not defined in the base, but the check is done against it.
> First condition is not passed because of the base in this case.
> I think, comparison should be done:
> {{fBase.fLength < fMinLength for }}{{(fBase.fFacetsDefined & FACET_LENGTH)
> != 0}}
> {{fLength < fMinLength for (fFacetsDefined & FACET_LENGTH) != 0}}
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]