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

@ -181,10 +181,7 @@ public final class DESedeWrapCipher extends CipherSpi {
engineInit(opmode, key, (AlgorithmParameterSpec) null, random);
} catch (InvalidAlgorithmParameterException iape) {
// should never happen
InvalidKeyException ike =
new InvalidKeyException("Parameters required");
ike.initCause(iape);
throw ike;
throw new InvalidKeyException("Parameters required", iape);
}
}
@ -285,11 +282,8 @@ public final class DESedeWrapCipher extends CipherSpi {
paramsEng.engineInit(params.getEncoded());
ivSpec = paramsEng.engineGetParameterSpec(IvParameterSpec.class);
} catch (Exception ex) {
InvalidAlgorithmParameterException iape =
new InvalidAlgorithmParameterException
("Wrong parameter type: IV expected");
iape.initCause(ex);
throw iape;
throw new InvalidAlgorithmParameterException
("Wrong parameter type: IV expected", ex);
}
}
engineInit(opmode, key, ivSpec, random);