commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r510582 - /jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/server/SimpleHost.java
Date Thu, 22 Feb 2007 16:42:44 GMT
Author: sebb
Date: Thu Feb 22 08:42:43 2007
New Revision: 510582

URL: http://svn.apache.org/viewvc?view=rev&rev=510582
Log:
Use super.clone() to ensure subclass clone() methods work

Modified:
    jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/server/SimpleHost.java

Modified: jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/server/SimpleHost.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/server/SimpleHost.java?view=diff&rev=510582&r1=510581&r2=510582
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/server/SimpleHost.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/server/SimpleHost.java
Thu Feb 22 08:42:43 2007
@@ -53,12 +53,18 @@
 
     public SimpleHost (final SimpleHost httphost) {
         super();
-        this.hostname = httphost.hostname;
-        this.port = httphost.port;
+        init(httphost);
     }
 
-    public Object clone() {
-        return new SimpleHost(this);
+	private void init(final SimpleHost httphost) {
+		this.hostname = httphost.hostname;
+        this.port = httphost.port;
+	}
+
+    public Object clone() throws CloneNotSupportedException {
+    	SimpleHost copy = (SimpleHost) super.clone();
+    	copy.init(this);
+        return copy;
     }    
     
     public String getHostName() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message