mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8233016: javax.crypto.Cipher throws NPE for the given custom CipherSpi and Provider
Changed to throw IAE instead of NPE for non-null invalid arguments Reviewed-by: mullan
This commit is contained in:
parent
ab280fcac4
commit
d4c0619b3b
1 changed files with 5 additions and 2 deletions
|
@ -264,15 +264,18 @@ public class Cipher {
|
||||||
* @param cipherSpi the delegate
|
* @param cipherSpi the delegate
|
||||||
* @param provider the provider
|
* @param provider the provider
|
||||||
* @param transformation the transformation
|
* @param transformation the transformation
|
||||||
|
* @throws NullPointerException if {@code provider} is {@code null}
|
||||||
|
* @throws IllegalArgumentException if the supplied arguments
|
||||||
|
* are deemed invalid for constructing the Cipher object
|
||||||
*/
|
*/
|
||||||
protected Cipher(CipherSpi cipherSpi,
|
protected Cipher(CipherSpi cipherSpi,
|
||||||
Provider provider,
|
Provider provider,
|
||||||
String transformation) {
|
String transformation) {
|
||||||
// See bug 4341369 & 4334690 for more info.
|
// See bug 4341369 & 4334690 for more info.
|
||||||
// If the caller is trusted, then okay.
|
// If the caller is trusted, then okay.
|
||||||
// Otherwise throw a NullPointerException.
|
// Otherwise throw an IllegalArgumentException.
|
||||||
if (!JceSecurityManager.INSTANCE.isCallerTrusted(provider)) {
|
if (!JceSecurityManager.INSTANCE.isCallerTrusted(provider)) {
|
||||||
throw new NullPointerException();
|
throw new IllegalArgumentException("Cannot construct cipher");
|
||||||
}
|
}
|
||||||
this.spi = cipherSpi;
|
this.spi = cipherSpi;
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue