harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r499252 - in /harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/MessageDigestSpi.java test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java
Date Wed, 24 Jan 2007 04:23:34 GMT
Author: smishura
Date: Tue Jan 23 20:23:33 2007
New Revision: 499252

URL: http://svn.apache.org/viewvc?view=rev&rev=499252
Log:
Corrected MessageDigestSpi.clone() and unit test

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/MessageDigestSpi.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/MessageDigestSpi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/MessageDigestSpi.java?view=diff&rev=499252&r1=499251&r2=499252
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/MessageDigestSpi.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/MessageDigestSpi.java
Tue Jan 23 20:23:33 2007
@@ -127,10 +127,6 @@
      * 
      */
     public Object clone() throws CloneNotSupportedException {
-        if (this instanceof Cloneable) {
-            return super.clone();
-        } else {
-            throw new CloneNotSupportedException();
-        }
+        return super.clone();
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java?view=diff&rev=499252&r1=499251&r2=499252
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java
Tue Jan 23 20:23:33 2007
@@ -67,17 +67,20 @@
 		}
 	}
 
-	/*
-	 * Class under test for Object clone()
-	 */
-	public void testClone() {
-		MyMessageDigest md = new MyMessageDigest();
-		try {
-			md.clone();
-			fail("No expected CloneNotSupportedException");
-		} catch (CloneNotSupportedException e) {			
-		}
-	}
+    /**
+     * @tests java.security.MessageDigestSpi#clone()
+     */
+    public void test_clone() throws CloneNotSupportedException {
+        MyMessageDigest md = new MyMessageDigest();
+        try {
+            md.clone();
+            fail("No expected CloneNotSupportedException");
+        } catch (CloneNotSupportedException e) {
+        }
+
+        MyMessageDigestCloneable mdc = new MyMessageDigestCloneable();
+        assertNotSame(mdc, mdc.clone());
+    }
 
 	private class MyMessageDigest extends MessageDigestSpi {
 		
@@ -91,10 +94,6 @@
 
 		public void engineUpdate(byte[] arg0, int arg1, int arg2) {}
 
-		public Object clone() throws CloneNotSupportedException {
-			throw new CloneNotSupportedException();
-		}
-
         @Override
         protected int engineDigest(byte[] buf, int offset, int len)
                 throws DigestException {
@@ -111,4 +110,8 @@
             super.engineUpdate(input);
         }
 	}
+    
+    private class MyMessageDigestCloneable extends MyMessageDigest implements
+            Cloneable {
+    }
 }



Mime
View raw message