Puskai Zoltán created XERCESJ-1729:
--------------------------------------

             Summary: 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


If I have a restriction in the xsd containing length and minLength(/maxLength)
{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.

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to