diff -r 6dd7bb19cef2 -r b35ee9b35b09 jdk/src/java.base/share/classes/java/security/Signature.java --- a/jdk/src/java.base/share/classes/java/security/Signature.java Mon Oct 31 13:57:28 2016 -0400 +++ b/jdk/src/java.base/share/classes/java/security/Signature.java Mon Oct 31 14:09:42 2016 -0700 @@ -213,16 +213,19 @@ * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard algorithm names. * - * @return the new Signature object. + * @return the new {@code Signature} object * - * @exception NoSuchAlgorithmException if no Provider supports a - * Signature implementation for the - * specified algorithm. + * @throws NoSuchAlgorithmException if no {@code Provider} supports a + * {@code Signature} implementation for the + * specified algorithm + * + * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider */ public static Signature getInstance(String algorithm) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); List list; if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { list = GetInstance.getServices(rsaIds); @@ -335,22 +338,25 @@ * * @param provider the name of the provider. * - * @return the new Signature object. + * @return the new {@code Signature} object * - * @exception NoSuchAlgorithmException if a SignatureSpi - * implementation for the specified algorithm is not - * available from the specified provider. + * @throws IllegalArgumentException if the provider name is {@code null} + * or empty * - * @exception NoSuchProviderException if the specified provider is not - * registered in the security provider list. + * @throws NoSuchAlgorithmException if a {@code SignatureSpi} + * implementation for the specified algorithm is not + * available from the specified provider * - * @exception IllegalArgumentException if the provider name is null - * or empty. + * @throws NoSuchProviderException if the specified provider is not + * registered in the security provider list + * + * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider */ public static Signature getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { // exception compatibility with existing code if ((provider == null) || (provider.length() == 0)) { @@ -385,13 +391,15 @@ * * @param provider the provider. * - * @return the new Signature object. + * @return the new {@code Signature} object + * + * @throws IllegalArgumentException if the provider is {@code null} * - * @exception NoSuchAlgorithmException if a SignatureSpi - * implementation for the specified algorithm is not available - * from the specified Provider object. + * @throws NoSuchAlgorithmException if a {@code SignatureSpi} + * implementation for the specified algorithm is not available + * from the specified {@code Provider} object * - * @exception IllegalArgumentException if the provider is null. + * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider * @@ -399,6 +407,7 @@ */ public static Signature getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { // exception compatibility with existing code if (provider == null) {