[ http://issues.apache.org/jira/browse/HTTPCLIENT-593?page=comments#action_12425329 ] Roland Weber commented on HTTPCLIENT-593: -----------------------------------------
> if (protocolB.equals(protocolA)) > System.out.println("What! protocolB == protocolA!!!"); > if (!protocolB.equals(protocolB)) > System.out.println("Uh, You may want to fix this"); These are good enough to convince me. The others were not. The contracts for equals and hasCodes were problematic in the very first version of Java, and have even been changed in later versions because of that. You can't expect them to be implemented correctly everywhere. But since protocols have to be compared to eachother, it's better to implement this change. cheers and thanks, Roland > ProtocolSocketFactory equals and hashCode don't support subclassing > ------------------------------------------------------------------- > > Key: HTTPCLIENT-593 > URL: http://issues.apache.org/jira/browse/HTTPCLIENT-593 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: Nightly Builds, 3.1 Alpha 1 > Reporter: Chris Audley > Priority: Minor > Fix For: 4.0 Alpha 1 > > > In the implemenation of equals and hashCode for the classes > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory > org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory > The implementation of equals and hashCode attempts to make all instances of > the classes equal. However, the manner in which the methods are coded makes > it necessary for any subclass to implement equals and hashCode themselves. A > minor change to the methods in these classes will make possible to subclass > these factories without re-implementing the equals and hashCode. The method > equals should be written as > return ((obj != null) && obj.getClass().equals(getClass())); > rather than > return ((obj != null) && > obj.getClass().equals(DefaultProtocolSocketFactory.class)); > And similarly, the hashCode method should be > return getClass().hashCode(); > rather than > return DefaultProtocolSocketFactory.class.hashCode(); -- 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]