From commits-return-60851-apmail-harmony-commits-archive=harmony.apache.org@harmony.apache.org Fri Nov 06 13:14:00 2009 Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 4089 invoked from network); 6 Nov 2009 13:14:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Nov 2009 13:14:00 -0000 Received: (qmail 91838 invoked by uid 500); 6 Nov 2009 13:14:00 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 91813 invoked by uid 500); 6 Nov 2009 13:14:00 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 91804 invoked by uid 99); 6 Nov 2009 13:14:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2009 13:14:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2009 13:13:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E25A423888E7; Fri, 6 Nov 2009 13:13:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r833384 - /harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java Date: Fri, 06 Nov 2009 13:13:36 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091106131336.E25A423888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Fri Nov 6 13:13:36 2009 New Revision: 833384 URL: http://svn.apache.org/viewvc?rev=833384&view=rev Log: Define hashCode for a SList.Server as it is put into a hash map. Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java?rev=833384&r1=833383&r2=833384&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java Fri Nov 6 13:13:36 2009 @@ -500,12 +500,14 @@ */ @Override public boolean equals(Object obj) { - SList.Server srv = null; - + if (this == obj) { + return true; + } if (!(obj instanceof SList.Server)) { return false; } - srv = (SList.Server) obj; + + SList.Server srv = (SList.Server) obj; if (serverIP == null || srv.getIP() == null) { if (this.getName() == null || srv.getName() == null) { return false; @@ -516,6 +518,14 @@ return this.getIP().equals(srv.getIP()) && this.getPort() == srv.getPort(); } + + /** + * Returns the hash code of the receiver. + */ + @Override + public int hashCode() { + return getIP().hashCode() + getPort(); + } /** * @return Returns the serverIP.