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 "Mukul Gandhi (Jira)" <xe...@xml.apache.org> on 2022/01/19 11:18:00 UTC
[jira] [Updated] (XERCESJ-1729) combination of restrictions length and minLength leads to error
[ https://issues.apache.org/jira/browse/XERCESJ-1729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mukul Gandhi updated XERCESJ-1729:
----------------------------------
Fix Version/s: 2.12.2
> 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: XML Schema 1.0 Datatypes, XML Schema 1.1 Datatypes
> Reporter: Puskai Zoltán
> Assignee: Mukul Gandhi
> Priority: Major
> Fix For: 2.12.2
>
>
> 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.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org