< prev index next >
src/java.base/share/classes/java/security/Signature.java
Print this page
rev 15967 : [mq]: GetInstance
*** 211,230 ****
* See the Signature section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Signature">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
! * @return the new Signature object.
*
! * @exception NoSuchAlgorithmException if no Provider supports a
! * Signature implementation for the
! * specified algorithm.
*
* @see Provider
*/
public static Signature getInstance(String algorithm)
throws NoSuchAlgorithmException {
List<Service> list;
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
list = GetInstance.getServices(rsaIds);
} else {
list = GetInstance.getServices("Signature", algorithm);
--- 211,233 ----
* See the Signature section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Signature">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
! * @return the new {@code Signature} object
*
! * @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<Service> list;
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
list = GetInstance.getServices(rsaIds);
} else {
list = GetInstance.getServices("Signature", algorithm);
*** 333,358 ****
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new Signature object.
*
! * @exception NoSuchAlgorithmException if a SignatureSpi
* implementation for the specified algorithm is not
! * available from the specified provider.
*
! * @exception NoSuchProviderException if the specified provider is not
! * registered in the security provider list.
*
! * @exception IllegalArgumentException if the provider name is null
! * or empty.
*
* @see Provider
*/
public static Signature getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
// exception compatibility with existing code
if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException("missing provider");
}
--- 336,364 ----
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new {@code Signature} object
! *
! * @throws IllegalArgumentException if the provider name is {@code null}
! * or empty
*
! * @throws NoSuchAlgorithmException if a {@code SignatureSpi}
* implementation for the specified algorithm is not
! * available from the specified provider
*
! * @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)) {
throw new IllegalArgumentException("missing provider");
}
*** 383,406 ****
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
! * @return the new Signature object.
*
! * @exception NoSuchAlgorithmException if a SignatureSpi
* implementation for the specified algorithm is not available
! * from the specified Provider object.
*
! * @exception IllegalArgumentException if the provider is null.
*
* @see Provider
*
* @since 1.4
*/
public static Signature getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
// exception compatibility with existing code
if (provider == null) {
throw new IllegalArgumentException("missing provider");
}
--- 389,415 ----
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
! * @return the new {@code Signature} object
! *
! * @throws IllegalArgumentException if the provider is {@code null}
*
! * @throws NoSuchAlgorithmException if a {@code SignatureSpi}
* implementation for the specified algorithm is not available
! * from the specified {@code Provider} object
*
! * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
* @since 1.4
*/
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) {
throw new IllegalArgumentException("missing provider");
}
< prev index next >