JDK-4990915 : XMLSchema: large values of maxOccurs are not supported
  • Type: Bug
  • Component: xml
  • Sub-Component: org.xml.sax
  • Affected Version: 5.0,7,8
  • Priority: P2
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2004-02-09
  • Updated: 2014-12-17
  • Resolved: 2013-12-08
Related Reports
Duplicate :  
Description
Name: eaR10174			Date: 02/09/2004


   Valid schemas with large values of the attribute 'maxOccurs' are not supported by
the current JAXP RI. RI reports that a value is not a valid value for the type
'nonNegativeInteger'. According to the XMLSchema Part 2: Datatypes specification
a value space of the type 'nonNegativeInteger' is the infinite set {0,1,2,...}.

The bug affects the following new JCK-15 beta2 tests adopted from W3C XSTC-20020116
testsuite:

   api/xml_schema/msxsdtest/Group/groupH009.html#groupH009_i
   api/xml_schema/msxsdtest/Group/groupJ009.html#groupJ009_i
   api/xml_schema/msxsdtest/Group/groupL009.html#groupL009_i
   api/xml_schema/msxsdtest/Group/groupN009.html#groupN009_i
   api/xml_schema/msxsdtest/Group/groupF009.html#groupF009_i
   api/xml_schema/msxsdtest/element/elemZ004.html#elemZ004

The following test fails running on JDK 1.5.0-beta-b35.
See below the test source and the execution log:
------------------------------------test.xsd------------------------------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             targetNamespace="test">
     <xsd:element name="root">
         <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="child" maxOccurs="999999999999999"/>
             </xsd:sequence>
         </xsd:complexType>
     </xsd:element>
</xsd:schema>
------------------------------------Test.java-----------------------------
import java.io.File;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.validation.SchemaFactory;

public class Test {

     protected static class ErrorHandler extends DefaultHandler {
         public int errorCounter = 0;

         public void error(SAXParseException e) throws SAXException {
             System.out.println(e);
             errorCounter++;
         }

         public void fatalError(SAXParseException e) throws SAXException {
             System.out.println(e);
             errorCounter++;
         }
     }

     public static void main(String [] args) {
         SchemaFactory schemaFactory =
                 SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");

         ErrorHandler errorHandler = new ErrorHandler();
         schemaFactory.setErrorHandler(errorHandler);

         try {
             schemaFactory.newSchema(new File(args[0]));
         } catch (SAXException e) {
             exit(1, "Fatal Error: " + e);
         }

         if (errorHandler.errorCounter == 0) {
             exit(1, "Failed: " + args[0] + " is valid");
         } else {
             exit(0, "Passed.");
         }
     }

     public static void exit(int errCode, String msg) {
         System.out.println(msg);
         System.exit(errCode);
     }
}
--------------------------------------------------------------------------
% java -showversion Test test.xsd
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b35)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b35, mixed mode)

org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute value
for 'maxOccurs' in element 'element'. Recorded reason: cvc-datatype-valid.1.2.1:
'999999999999999' is not a valid value for 'nonNegativeInteger'.
Fatal Error: org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid
attribute value for 'maxOccurs' in element 'element'.
Recorded reason: cvc-datatype-valid.1.2.1: '999999999999999' is not a valid
value for 'nonNegativeInteger'.
--------------------------------------------------------------------------

======================================================================
The following JCK tests are also affected:
api/xml_schema/msxsdtest/ModelGroups/mgG014.html#mgG014_i
api/xml_schema/msxsdtest/ModelGroups/mgJ014.html#mgJ014_i

Output is like this:
Error: file:/net/archer/export5/re/jck/6.0/nightly/qac/b24-2006-05-15/binaries/JCK-runtime-60/tests/api/xml_schema/msxsdtest/ModelGroups/mgG014.xsd(5,53): Current configuration of the parser doesn't allow a maxOccurs attribute value to be set greater than the value 5,000.
CR cannot be closed because it desribes RI bug.

Comments
Closing the issue as won't fix as agreed by JCK and is now 8-defer-approved.
08-12-2013

Agree that this bug can be deferred (actually closed as will not fix). I will ask our QA team to permanently delete the following tests from the JCK: xml_schema/msData/element/jaxb/elemZ004.html#elemZ004 JDK-4990915 placeholder xml_schema/msData/element/jaxb/elemZ031.html#elemZ031 JDK-4990915 placeholder xml_schema/msData/element/jaxp/elemZ004.html#elemZ004 JDK-4990915 placeholder xml_schema/msData/element/jaxp/elemZ031.html#elemZ031 JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupF009v.html#groupF009v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupF009v.html#groupF009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupH009v.html#groupH009v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupH009v.html#groupH009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupJ009v.html#groupJ009v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupJ009v.html#groupJ009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupL009v.html#groupL009v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupL009v.html#groupL009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupN009v.html#groupN009v JDK-4990915 placeholder xml_schema/msData/group/jaxb/groupN009v.html#groupN009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxp/groupF009v.html#groupF009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxp/groupH009v.html#groupH009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxp/groupJ009v.html#groupJ009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxp/groupL009v.html#groupL009v.v JDK-4990915 placeholder xml_schema/msData/group/jaxp/groupN009v.html#groupN009v.v JDK-4990915 placeholder xml_schema/msData/particles/jaxb/particlesZ033_a.html#particlesZ033_a JDK-4990915 placeholder xml_schema/msData/particles/jaxp/particlesZ033_a.html#particlesZ033_a JDK-4990915 placeholder
06-12-2013

Release team: Needs JCK team to exclude the test first. Once done this is approved for deferral and you can update the label.
06-12-2013

It is one minor issue and SQE is ok to defer it. "8-defer-SQE-OK" has been added.
06-12-2013

Refer to JDK-6974511, this is a limitation of the implementation. The decision was wont fix.
02-12-2013

EVALUATION Setting such as a large value is not very practical. For the current implementation itself, allowing large values of maxOccurs generally is also not practical. There were efforts to improve the situation (such as CR 6859210), but a more general solution is unfortunately not available. I also lowered the priority since this CR was reported on JDK5, and there has been no activity on this issue for a long time, I assume the impact is low.
22-12-2010

EVALUATION RI doesn't still support max/minOccurs great than 2147483647 although according to the spec: maxOccurs = (nonNegativeInteger | unbounded) : 1 minOccurs = nonNegativeInteger : 1 and nonNegativeInteger <= +123456789012345678901234567890. It contradicts the specification: XML Schema Part 1: Structures Second Edition
25-03-2010

EVALUATION is a know limitation in xerces [ The values of minOccurs and maxOccurs attributes are limited to the value 2147483647],and will be taken care of. ###@###.### 2004-02-09
09-02-2004