Uploaded image for project: 'XmlSchema'
  1. XmlSchema
  2. XMLSCHEMA-30

Each type from W3C base schema (http://www.w3.org/2001/XMLSchema) is equals to each other

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.0.2, 2.0.3, 2.1.0
    • 2.1.0
    • Oracle JDK-1.6
      Oracle JDK-1.7

    Description

      MAIN DESCIPRTION

      At this time, all simple types of the base xml schema ( W3C Schema has namesapce http://www.w3.org/2001/XMLSchema ) always equlals to each other from point of view Object@equals method, but they have different hash codes.
      I've attched a simple sample_proj.zip project to be more clean.

      Such situation may lead to wrong behaviour of some Set or Map implementations.
      F.e. ImmutableSet of Guava project doesn't copy all items from java.util.HashSet over creation operation ( ImmutableSet#copyOf )

      Moreover, such behaviuor isn't in accordance with Oracle rules

      DETAILS

      Comparison of a XmlSchemaType (both simple and complex) is performed by XmlSchemaObject#equals method.
      This method takes in account folowing properties of a XmlSchemaObject:

      • lineNumber
      • linePosition
      • sourceURI

      But all base W3C xsd types (namespace http://www.w3.org/2001/XMLSchema ) has one peculiarity: all the above properties is not set throughout base W3C schema creation.

      XmlSchemaCollection#addSimpletype method is responsible for creation all these base schema simple types.

      In result, all these "synthatic" types may be distinguished by they QNames only.

      SIGGESTION

      I suggest to override equals method on XmlSchemaType class with taking in account its namedDelegate field comparison result.

      Attachments

        1. sample_proj.zip
          3 kB
          Alexandr Klimov

        Activity

          People

            dkulp Daniel Kulp
            sasa-zmei Alexandr Klimov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: