diff options
author | Kenny Root <kroot@google.com> | 2014-05-16 13:33:17 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2014-05-20 11:03:31 -0700 |
commit | 76b889a697b7408b6721b1e9592334c8d36fdeeb (patch) | |
tree | d5e0b8ae9125d3760029ee654b45c228a35d6329 | |
parent | f7a15ff43004414e1eaa35872e9307383bdf84e4 (diff) | |
download | libcore-76b889a697b7408b6721b1e9592334c8d36fdeeb.zip libcore-76b889a697b7408b6721b1e9592334c8d36fdeeb.tar.gz libcore-76b889a697b7408b6721b1e9592334c8d36fdeeb.tar.bz2 |
Signature: remove unnecessary throw on clone
If a class couldn't be cloned, it would throw its own exception.
Instead, rely on the default implementation of "clone" to give a better
error message when the target class isn't cloneable.
Change-Id: I2cae9cdad9b4a7cf7fe50f7ad37fd22c1a97c825
-rw-r--r-- | luni/src/main/java/java/security/Signature.java | 15 | ||||
-rw-r--r-- | luni/src/main/java/java/security/SignatureSpi.java | 5 |
2 files changed, 3 insertions, 17 deletions
diff --git a/luni/src/main/java/java/security/Signature.java b/luni/src/main/java/java/security/Signature.java index 24f5298..7dd7d93 100644 --- a/luni/src/main/java/java/security/Signature.java +++ b/luni/src/main/java/java/security/Signature.java @@ -624,14 +624,6 @@ public abstract class Signature extends SignatureSpi { return engineGetParameter(param); } - @Override - public Object clone() throws CloneNotSupportedException { - if (this instanceof Cloneable) { - return super.clone(); - } - throw new CloneNotSupportedException(); - } - /** * Internal Signature implementation */ @@ -711,11 +703,8 @@ public abstract class Signature extends SignatureSpi { @Override public Object clone() throws CloneNotSupportedException { - if (spiImpl instanceof Cloneable) { - SignatureSpi spi = (SignatureSpi) spiImpl.clone(); - return new SignatureImpl(getAlgorithm(), getProvider(), spiImpl); - } - throw new CloneNotSupportedException(); + SignatureSpi spi = (SignatureSpi) spiImpl.clone(); + return new SignatureImpl(getAlgorithm(), getProvider(), spi); } /** diff --git a/luni/src/main/java/java/security/SignatureSpi.java b/luni/src/main/java/java/security/SignatureSpi.java index 27be30c..66c43d7 100644 --- a/luni/src/main/java/java/security/SignatureSpi.java +++ b/luni/src/main/java/java/security/SignatureSpi.java @@ -307,9 +307,6 @@ public abstract class SignatureSpi { @Override public Object clone() throws CloneNotSupportedException { - if (this instanceof Cloneable) { - return super.clone(); - } - throw new CloneNotSupportedException(); + return super.clone(); } } |