You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/04/11 08:42:44 UTC

DO NOT REPLY [Bug 18938] New: - URI does not over-ride hashcode()

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18938>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18938

URI does not over-ride hashcode()

           Summary: URI does not over-ride hashcode()
           Product: Axis
           Version: 1.1rc2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: david.kemp@melbourneit.com.au


org.apache.axis.types.URI is not over-riding hashcode() and so it can not be
used as a key to a hashmap.

$ java -fullversion
java full version "1.3.1_03-b03"

Test program:

import org.apache.axis.types.URI;
import org.apache.axis.types.URI.MalformedURIException;

public class URITest {

    public static void main(String[] args) throws MalformedURIException {
    	URI uri1 = new URI("urn:foobar");
		URI uri2 = new URI("urn:foobar");
		System.out.print("Equals: ");
		System.out.println((uri1.equals(uri2)) ?"pass" : "fail");
		System.out.print("Hashcode: ");
		System.out.println((uri1.hashCode() == uri2.hashCode()) ? "pass" : "fail");
   }
}

The result is:

Equals: pass
Hashcode: fail