8274079: Cleanup unnecessary calls to Throwable.initCause() in java.base module

Reviewed-by: weijun
This commit is contained in:
Andrey Turbanov 2021-10-05 13:36:37 +00:00 committed by Weijun Wang
parent 8609ea55ac
commit 1459180f35
22 changed files with 55 additions and 132 deletions

View file

@ -76,16 +76,10 @@ final class ConstructKeys {
encodedKeyAlgorithm +
"algorithm");
} catch (InvalidKeySpecException ikse2) {
InvalidKeyException ike =
new InvalidKeyException("Cannot construct public key");
ike.initCause(ikse2);
throw ike;
throw new InvalidKeyException("Cannot construct public key", ikse2);
}
} catch (InvalidKeySpecException ikse) {
InvalidKeyException ike =
new InvalidKeyException("Cannot construct public key");
ike.initCause(ikse);
throw ike;
throw new InvalidKeyException("Cannot construct public key", ikse);
}
return key;
@ -116,16 +110,10 @@ final class ConstructKeys {
encodedKeyAlgorithm +
"algorithm");
} catch (InvalidKeySpecException ikse2) {
InvalidKeyException ike =
new InvalidKeyException("Cannot construct private key");
ike.initCause(ikse2);
throw ike;
throw new InvalidKeyException("Cannot construct private key", ikse2);
}
} catch (InvalidKeySpecException ikse) {
InvalidKeyException ike =
new InvalidKeyException("Cannot construct private key");
ike.initCause(ikse);
throw ike;
throw new InvalidKeyException("Cannot construct private key", ikse);
} finally {
SharedSecrets.getJavaSecuritySpecAccess().clearEncodedKeySpec(keySpec);
if (keyBytes != encodedKey) {