You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2014/01/21 18:06:20 UTC

[jira] [Resolved] (XMLSCHEMA-30) Each type from W3C base schema (http://www.w3.org/2001/XMLSchema) is equals to each other

     [ https://issues.apache.org/jira/browse/XMLSCHEMA-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved XMLSCHEMA-30.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.4
         Assignee: Daniel Kulp

github pull request applied

> Each type from W3C base schema (http://www.w3.org/2001/XMLSchema) is equals to each other
> -----------------------------------------------------------------------------------------
>
>                 Key: XMLSCHEMA-30
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-30
>             Project: XmlSchema
>          Issue Type: Bug
>    Affects Versions: 2.0.2, 2.0.3, 2.0.4
>         Environment: Oracle JDK-1.6
> Oracle JDK-1.7
>            Reporter: Alexandr Klimov
>            Assignee: Daniel Kulp
>            Priority: Critical
>              Labels: XmlSchemaType, comparison, equals, hashCode
>             Fix For: 2.0.4
>
>         Attachments: sample_proj.zip
>
>
> h2. 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|http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()]
> h2. 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.
> h2. SIGGESTION
> I suggest to override *equals* method on *XmlSchemaType* class with taking in account its *namedDelegate* field comparison result.
>  



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org