Mario Torre wrote:
This patch is hopefully a fix for clone method in
gnu.java.security.OID.java
Can someone please comment on this?

Thank you,
Mario

2006-07-12  Mario Torre  <[EMAIL PROTECTED]>

        * gnu/java/security/OID.java (clone): Fixed.



------------------------------------------------------------------------

### Eclipse Workspace Patch 1.0
#P classpath
Index: gnu/java/security/OID.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/java/security/OID.java,v
retrieving revision 1.7
diff -u -r1.7 OID.java
--- gnu/java/security/OID.java  20 May 2006 03:25:09 -0000      1.7
+++ gnu/java/security/OID.java  12 Jul 2006 17:15:01 -0000
@@ -325,10 +325,16 @@
    */
   public Object clone()
   {
-    OID oid = new OID();
-    oid.components = this.components;
-    oid.strRep = this.strRep;
-    return oid;
+    try
+      {
+        return super.clone();
+      }
+    catch (CloneNotSupportedException cnse)
+      {
+        InternalError ie = new InternalError();
+        ie.initCause(cnse);
+        throw ie;
+      }
   }
/* Nice idea, but possibly too expensive for whatever benefit it

Looks good to me. I beleive this is the prefered idiom for clone() in many cases. It seems that this is probably one of them, but not being that familiar with this class I cannot say for sure.

David Daney.


Reply via email to