< prev index next >

src/java.base/share/classes/java/security/SecureRandom.java

Print this page
rev 15967 : [mq]: GetInstance

*** 301,322 **** * See the {@code SecureRandom} section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#SecureRandom"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard RNG algorithm names. * ! * @return the new {@code SecureRandom} object. * ! * @exception NoSuchAlgorithmException if no Provider supports a * {@code SecureRandomSpi} implementation for the ! * specified algorithm. * * @see Provider * * @since 1.2 */ public static SecureRandom getInstance(String algorithm) throws NoSuchAlgorithmException { Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm); return new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm); } --- 301,325 ---- * See the {@code SecureRandom} section in the <a href= * "{@docRoot}/../technotes/guides/security/StandardNames.html#SecureRandom"> * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard RNG algorithm names. * ! * @return the new {@code SecureRandom} object * ! * @throws NoSuchAlgorithmException if no {@code Provider} supports a * {@code SecureRandomSpi} implementation for the ! * specified algorithm ! * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider * * @since 1.2 */ public static SecureRandom getInstance(String algorithm) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm); return new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm); }
*** 339,366 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard RNG algorithm names. * * @param provider the name of the provider. * ! * @return the new {@code SecureRandom} object. * * @throws NoSuchAlgorithmException if a {@code SecureRandomSpi} * 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 IllegalArgumentException if the provider name is null ! * or empty. * * @see Provider * * @since 1.2 */ public static SecureRandom getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, provider); return new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm); } --- 342,372 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard RNG algorithm names. * * @param provider the name of the provider. * ! * @return the new {@code SecureRandom} object ! * ! * @throws IllegalArgumentException if the provider name is {@code null} ! * or empty * * @throws NoSuchAlgorithmException if a {@code SecureRandomSpi} * 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 * * @since 1.2 */ public static SecureRandom getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + Objects.requireNonNull(algorithm, "null algorithm name"); Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, provider); return new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm); }
*** 380,403 **** * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard RNG algorithm names. * * @param provider the provider. * ! * @return the new {@code SecureRandom} object. * * @throws NoSuchAlgorithmException if a {@code SecureRandomSpi} * implementation for the specified algorithm is not available ! * from the specified {@code Provider} object. * ! * @throws IllegalArgumentException if the specified provider is null. * * @see Provider * * @since 1.4 */ public static SecureRandom getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, provider); return new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm); } --- 386,413 ---- * Java Cryptography Architecture Standard Algorithm Name Documentation</a> * for information about standard RNG algorithm names. * * @param provider the provider. * ! * @return the new {@code SecureRandom} object ! * ! * @throws IllegalArgumentException if the specified provider is ! * {@code null} * * @throws NoSuchAlgorithmException if a {@code SecureRandomSpi} * 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 SecureRandom getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, provider); return new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm); }
*** 431,455 **** * for information about standard RNG algorithm names. * * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * ! * @return the new {@code SecureRandom} object. * * @throws NoSuchAlgorithmException if no Provider supports a * {@code SecureRandomSpi} implementation for the specified ! * algorithm and parameters. * ! * @throws IllegalArgumentException if the specified params is null. * * @see Provider * * @since 9 */ public static SecureRandom getInstance( String algorithm, SecureRandomParameters params) throws NoSuchAlgorithmException { if (params == null) { throw new IllegalArgumentException("params cannot be null"); } Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, params); --- 441,469 ---- * for information about standard RNG algorithm names. * * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * ! * @return the new {@code SecureRandom} object ! * ! * @throws IllegalArgumentException if the specified params is ! * {@code null} * * @throws NoSuchAlgorithmException if no Provider supports a * {@code SecureRandomSpi} implementation for the specified ! * algorithm and parameters * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider * * @since 9 */ public static SecureRandom getInstance( String algorithm, SecureRandomParameters params) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (params == null) { throw new IllegalArgumentException("params cannot be null"); } Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, params);
*** 479,507 **** * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * * @param provider the name of the provider. * ! * @return the new {@code SecureRandom} object. * * @throws NoSuchAlgorithmException if the specified provider does not * support a {@code SecureRandomSpi} implementation for the ! * specified algorithm and parameters. * * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list. * ! * @throws IllegalArgumentException if the provider name is null ! * or empty, or params is null. * * @see Provider * * @since 9 */ public static SecureRandom getInstance(String algorithm, SecureRandomParameters params, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { if (params == null) { throw new IllegalArgumentException("params cannot be null"); } Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, params, provider); --- 493,524 ---- * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * * @param provider the name of the provider. * ! * @return the new {@code SecureRandom} object ! * ! * @throws IllegalArgumentException if the provider name is {@code null} ! * or empty, or params is {@code null} * * @throws NoSuchAlgorithmException if the specified provider does not * support a {@code SecureRandomSpi} implementation for the ! * specified algorithm and parameters * * @throws NoSuchProviderException if the specified provider is not ! * registered in the security provider list * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider * * @since 9 */ public static SecureRandom getInstance(String algorithm, SecureRandomParameters params, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (params == null) { throw new IllegalArgumentException("params cannot be null"); } Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, params, provider);
*** 529,554 **** * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * * @param provider the provider. * ! * @return the new {@code SecureRandom} object. * * @throws NoSuchAlgorithmException if the specified provider does not * support a {@code SecureRandomSpi} implementation for the ! * specified algorithm and parameters. * ! * @throws IllegalArgumentException if the specified provider or params ! * is null. * * @see Provider * * @since 9 */ public static SecureRandom getInstance(String algorithm, SecureRandomParameters params, Provider provider) throws NoSuchAlgorithmException { if (params == null) { throw new IllegalArgumentException("params cannot be null"); } Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, params, provider); --- 546,574 ---- * @param params the {@code SecureRandomParameters} * the newly created {@code SecureRandom} object must support. * * @param provider the provider. * ! * @return the new {@code SecureRandom} object ! * ! * @throws IllegalArgumentException if the specified provider or params ! * is {@code null} * * @throws NoSuchAlgorithmException if the specified provider does not * support a {@code SecureRandomSpi} implementation for the ! * specified algorithm and parameters * ! * @throws NullPointerException if {@code algorithm} is {@code null} * * @see Provider * * @since 9 */ public static SecureRandom getInstance(String algorithm, SecureRandomParameters params, Provider provider) throws NoSuchAlgorithmException { + Objects.requireNonNull(algorithm, "null algorithm name"); if (params == null) { throw new IllegalArgumentException("params cannot be null"); } Instance instance = GetInstance.getInstance("SecureRandom", SecureRandomSpi.class, algorithm, params, provider);
< prev index next >