[ http://issues.apache.org/jira/browse/XALANJ-990?page=all ]

Brian Minchau updated XALANJ-990:
---------------------------------

    Version: 2.4
                 (was: Latest Development Code)

> QName.hashCode() inconsistent with QName.equals(Object)
> -------------------------------------------------------
>
>          Key: XALANJ-990
>          URL: http://issues.apache.org/jira/browse/XALANJ-990
>      Project: XalanJ2
>         Type: Bug
>   Components: Other
>     Versions: 2.4
>  Environment: Operating System: All
> Platform: All
>     Reporter: Achille Fokoue
>     Assignee: Xalan Developers Mailing List
>     Priority: Minor

>
> Part of the general contract of hashCode() method is that "If two objects are 
> equal according to the equals(Object) method, then calling the hashCode 
> method 
> on each of the two objects must produce the same integer result."
> Unfortunately, this is not true for org.apache.xml.utils.QName. In fact, 
> QName.hashCode() is a function of its prefix, its namespace and its local 
> name 
> whereas QName.equals(Object) is just a function of its namespace and local 
> name. This means that two QNames which differ only by their prefixes would be 
> considered equal but their hashCode values would be different( e.g. new QName
> ("http://examples.org","a";, "example") and new QName
> ("http://examples.org","b";, "example").
> This inconsistency could lead to serious bugs if QNames are used as keys of 
> hash maps.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to