[SNMP4J] hashCode of OID not unique
Natterer, Thomas
thomas.natterer at thalesatm.com
Thu Oct 12 10:33:14 CEST 2006
Hi,
the hash code returned by the method OID::hashCode()
is not unique !
For example:
OID oid1 = new OID("1.3.6.1.2.1.33.1.6.1.0");
System.out.println("OID1-" + oid1 + " Hash-" + oid1.hashCode());
OID oid2 = new OID("1.3.6.1.2.1.33.1.2.5.0");
System.out.println("OID2-" + oid2 + " Hash-" + oid2.hashCode());
OID1-1.3.6.1.2.1.33.1.6.1.0 Hash-1650
OID2-1.3.6.1.2.1.33.1.2.5.0 Hash-1650
This could cause problems if somebody want to store OID objects in a
Hashtable using the hash code as key.
I would suggest to improve the method OID::hashCode
See for example:
http://www.javapractices.com/Topic28.cjp
Best regards
More information about the SNMP4J
mailing list