Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4956511

uniqueness violation is detected for unrelated key values

    XMLWordPrintable

Details

    • 1.3
    • generic
    • generic

    Backports

      Description

        Name: erR10175 Date: 11/19/2003


         
        The test
          api/xml_schema/structures/IdConstrDefs/fields/fields00202m/fields00202m3.html#Positive

        fails because RI detects identity constraint violation in the document (see below).
        The error message contains the following:
        fields00202m3_p.xml(16,46): Duplicate unique value [ID Value: 3.0] declared for
        identity constraint of element "root".

        In the test the fields have different types xsd:string and xsd:decimal.
        While the lexical representations are the same, the fields are not equal due to
        unrelated value spaces of their types. So the uniqueness constraint is not violated
        and the test expects the validator to pass. For more details see the XML Schema
        specification.

         http://www.w3.org/TR/xmlschema-1/#section-Identity-constraint-Definition-Validation-Rules
         http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes#equal

        The bug is found in jdk1.5.0/beta/b28 and is reproducible with all versions
        of JAXP 1.2. The bug was not found because the test in JAXP TCK 1.2 and
        in JCK 1.5 b08 had a bug (see bug 4953550). Recently the test has been
        fixed and renamed from
          api/xml_schema/structures/IdConstrDefs/fields/fields00202m/fields00202m3.html#Negative
        to
          api/xml_schema/structures/IdConstrDefs/fields/fields00202m/fields00202m3.html#Positive
         
        The test's schema is:
        -------------------------- fields00202m3.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema
          xmlns="IdConstrDefs/fields"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          targetNamespace="IdConstrDefs/fields">

          <xsd:element name="root">
              <xsd:complexType>
                  <xsd:sequence maxOccurs="unbounded">
                      <xsd:element name="number" type="xsd:anySimpleType"/>
                  </xsd:sequence>
              </xsd:complexType>
              <xsd:unique name="UNIQUENESS">
                  <xsd:selector xpath="./number"/>
                  <xsd:field xpath="."/>
              </xsd:unique>
          </xsd:element>

        </xsd:schema>
        --------------------------

        The valid document is:
        -------------------------- fields00202m3_p.xml
        <?xml version="1.0" encoding="UTF-8"?>
        <test:root
          xmlns:test="IdConstrDefs/fields"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xsi:schemaLocation="IdConstrDefs/fields fields00202m3.xsd">
          <number xsi:type="xsd:string">3.0</number>
          <number xsi:type="xsd:decimal">3.0</number>
        </test:root>
        --------------------------

        ======================================================================

        Attachments

          Issue Links

            Activity

              People

                kkawagucsunw Kohsuke Kawaguchi (Inactive)
                reysunw Rey Rey (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: