From 28839b70d0fa8703311d39ca2ce1f8a17b8d20d6 Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Mon, 30 Aug 2004 10:25:38 +0000 Subject: DummyKeyPairGenerator.java (clone): Removed useless instanceof check. 2004-08-30 Casey Marshall * java/security/DummyKeyPairGenerator.java (clone): Removed useless instanceof check. * java/security/DummyMessageDigest.java (clone): Likewise. * java/security/DummySignature.java (clone): Likewise. * java/security/MessageDigest.java (clone): Remove useless instanceof check. * java/security/MessageDigestSpi.java (clone): Likewise. * java/security/Signature.java (clone): Provide meaningful implementation. * java/security/SignatureSpi.java (clone): Likewise. From-SVN: r86755 --- libjava/java/security/MessageDigest.java | 43 +++++++++++++++----------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'libjava/java/security/MessageDigest.java') diff --git a/libjava/java/security/MessageDigest.java b/libjava/java/security/MessageDigest.java index 47b082a..8e4dfec 100644 --- a/libjava/java/security/MessageDigest.java +++ b/libjava/java/security/MessageDigest.java @@ -102,9 +102,9 @@ public abstract class MessageDigest extends MessageDigestSpi /** * Creates a message digest with the specified algorithm name. * - * @param algorithm the standard name of the digest algorithm. - * See Appendix A in the Java Cryptography Architecture API - * Specification & Reference for information about standard + * @param algorithm the standard name of the digest algorithm. + * See Appendix A in the Java Cryptography Architecture API + * Specification & Reference for information about standard * algorithm names. */ protected MessageDigest(String algorithm) @@ -134,11 +134,11 @@ public abstract class MessageDigest extends MessageDigestSpi Provider[] p = Security.getProviders(); for (int i = 0; i < p.length; i++) { - try - { - return getInstance(algorithm, p[i]); - } - catch (NoSuchAlgorithmException ignored) {} + try + { + return getInstance(algorithm, p[i]); + } + catch (NoSuchAlgorithmException ignored) {} } throw new NoSuchAlgorithmException(algorithm); @@ -206,17 +206,17 @@ public abstract class MessageDigest extends MessageDigestSpi } catch (java.lang.reflect.InvocationTargetException ite) { - throw new NoSuchAlgorithmException(algorithm); + throw new NoSuchAlgorithmException(algorithm); } - + if (o instanceof MessageDigestSpi) { - result = new DummyMessageDigest((MessageDigestSpi) o, algorithm); + result = new DummyMessageDigest((MessageDigestSpi) o, algorithm); } else if (o instanceof MessageDigest) { - result = (MessageDigest) o; - result.algorithm = algorithm; + result = (MessageDigest) o; + result.algorithm = algorithm; } else { @@ -335,7 +335,7 @@ public abstract class MessageDigest extends MessageDigestSpi for (int i = digesta.length - 1; i >= 0; --i) if (digesta[i] != digestb[i]) - return false; + return false; return true; } @@ -383,10 +383,7 @@ public abstract class MessageDigest extends MessageDigestSpi */ public Object clone() throws CloneNotSupportedException { - if (this instanceof Cloneable) - return super.clone(); - else - throw new CloneNotSupportedException(); + return super.clone(); } private String digestToString() @@ -400,12 +397,12 @@ public abstract class MessageDigest extends MessageDigestSpi int len = digest.length; for (int i = 0; i < len; ++i) { - byte b = digest[i]; - byte high = (byte) ((b & 0xff) >>> 4); - byte low = (byte) (b & 0xf); + byte b = digest[i]; + byte high = (byte) ((b & 0xff) >>> 4); + byte low = (byte) (b & 0xf); - buf.append(high > 9 ? ('a' - 10) + high : '0' + high); - buf.append(low > 9 ? ('a' - 10) + low : '0' + low); + buf.append(high > 9 ? ('a' - 10) + high : '0' + high); + buf.append(low > 9 ? ('a' - 10) + low : '0' + low); } return buf.toString(); -- cgit v1.1