Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 995 invoked from network); 6 Nov 2009 13:03:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Nov 2009 13:03:43 -0000 Received: (qmail 79847 invoked by uid 500); 6 Nov 2009 13:03:43 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 79825 invoked by uid 500); 6 Nov 2009 13:03:43 -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 79816 invoked by uid 99); 6 Nov 2009 13:03:43 -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:03:43 +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:03:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A589B2388905; Fri, 6 Nov 2009 13:03:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r833382 - /harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java Date: Fri, 06 Nov 2009 13:03:19 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091106130319.A589B2388905@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Fri Nov 6 13:03:19 2009 New Revision: 833382 URL: http://svn.apache.org/viewvc?rev=833382&view=rev Log: Reimplement clone() to call super clone, so subclasses get the right type. Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java?rev=833382&r1=833381&r2=833382&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSContext.java Fri Nov 6 13:03:19 2009 @@ -312,20 +312,32 @@ * @param name * name of newly created context in the ancestor context */ - @SuppressWarnings("unchecked") DNSContext(DNSContext ancestorCtx, DNSName name) { - this.contextName = (DNSName) name.clone(); - this.nameParser = ancestorCtx.nameParser; - this.environment = (Hashtable) ancestorCtx.environment - .clone(); - this.resolver = ancestorCtx.resolver; - this.authoritative = ancestorCtx.authoritative; - this.lookupAttrType = ancestorCtx.lookupAttrType; - this.lookupAttrClass = ancestorCtx.lookupAttrClass; - this.recursion = ancestorCtx.recursion; - this.timeoutInitial = ancestorCtx.timeoutInitial; - this.timeoutRetries = ancestorCtx.timeoutRetries; - this.maxThreads = ancestorCtx.maxThreads; + super(); + initialize(ancestorCtx, name); + } + + /** + * Initialize all private properties from the given context. + * + * @param ancestorCtx + * an ancestor context to read all internal properties from + * @param name + * name of newly created context in the ancestor context + */ + @SuppressWarnings("unchecked") + private void initialize(DNSContext ancestorCtx, DNSName name) { + contextName = (DNSName) name.clone(); + nameParser = ancestorCtx.nameParser; + environment = (Hashtable) ancestorCtx.environment.clone(); + resolver = ancestorCtx.resolver; + authoritative = ancestorCtx.authoritative; + lookupAttrType = ancestorCtx.lookupAttrType; + lookupAttrClass = ancestorCtx.lookupAttrClass; + recursion = ancestorCtx.recursion; + timeoutInitial = ancestorCtx.timeoutInitial; + timeoutRetries = ancestorCtx.timeoutRetries; + maxThreads = ancestorCtx.maxThreads; } /** @@ -2037,7 +2049,15 @@ */ @Override public Object clone() { - return new DNSContext(this, contextName); + DNSContext clone; + try { + clone = (DNSContext)super.clone(); + } catch (CloneNotSupportedException e) { + // impossible + return null; + } + clone.initialize(this, contextName); + return clone; } /**