diff options
author | Casey Marshall <csm@gnu.org> | 2004-08-30 10:25:38 +0000 |
---|---|---|
committer | Andreas Tobler <andreast@gcc.gnu.org> | 2004-08-30 12:25:38 +0200 |
commit | 28839b70d0fa8703311d39ca2ce1f8a17b8d20d6 (patch) | |
tree | d5939b84cb5fa05f18e3b26411d09f41525bcafd /libjava/java/security/MessageDigest.java | |
parent | ce521a9c85bfb120a9904293897a256e83477eca (diff) | |
download | gcc-28839b70d0fa8703311d39ca2ce1f8a17b8d20d6.zip gcc-28839b70d0fa8703311d39ca2ce1f8a17b8d20d6.tar.gz gcc-28839b70d0fa8703311d39ca2ce1f8a17b8d20d6.tar.bz2 |
DummyKeyPairGenerator.java (clone): Removed useless instanceof check.
2004-08-30 Casey Marshall <csm@gnu.org>
* 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
Diffstat (limited to 'libjava/java/security/MessageDigest.java')
-rw-r--r-- | libjava/java/security/MessageDigest.java | 43 |
1 files changed, 20 insertions, 23 deletions
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(); |