Index: modules/security/src/main/java/common/java/security/Signature.java =================================================================== --- modules/security/src/main/java/common/java/security/Signature.java (revision 438066) +++ modules/security/src/main/java/common/java/security/Signature.java (working copy) @@ -112,6 +112,9 @@ */ public static Signature getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { + if (algorithm == null) { + throw new NullPointerException("Algorithm is null"); + } if ((provider == null) || (provider.length() == 0)) { throw new IllegalArgumentException( "Provider is null or empty string"); @@ -121,7 +124,7 @@ throw new NoSuchProviderException("Provider " + provider + " is not available"); } - return getInstance(algorithm, p); + return getSignatureInstance(algorithm, p); } /** @@ -130,12 +133,17 @@ */ public static Signature getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { + if (algorithm == null) { + throw new NullPointerException("Algorithm is null"); + } if (provider == null) { throw new IllegalArgumentException("Provider is null"); } - if (algorithm == null) { - throw new NullPointerException("Algorithm is null"); - } + return getSignatureInstance(algorithm, provider); + } + + private static Signature getSignatureInstance(String algorithm, + Provider provider) throws NoSuchAlgorithmException { Signature result; synchronized (engine) { engine.getInstance(algorithm, provider, null);