-
Bug
-
Resolution: Won't Fix
-
P2
-
5.0, 7, 8
-
1.5
-
generic
-
generic
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.
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.
- duplicates
-
JDK-6974511 The values of minOccurs and maxOccurs attributes are limited to the value 2147483647.
- Closed