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=17507>. 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=17507 Priority does not override hashCode() method Summary: Priority does not override hashCode() method Product: Log4j Version: 1.2 Platform: All OS/Version: All Status: NEW Severity: Minor Priority: Other Component: Appender AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi, >From the Javadoc on java.lang.Object: 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. The org.apache.log4j.Priority class overrides equals so that equality depends on the integer "level". hashCode() is not overridden. Because of this, I had problems adding and retrieving Priority classes from a HashMap. Obviously the fix is pretty simple. Please copy / paste the following code into the class: ----------- Cut here ------------ /** * Prority returns its level as its hashCode so that the * hashCodes will be equal if equals() returns true. This * method makes the Priority class behave as it should when * it is added to a HashMap. * @return int */ public int hashCode() { return level; } ----------- Cut here ------------ Cheers and Best Regards, Dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]