src/java.base/share/classes/sun/security/util/SignatureUtil.java
changeset 53069 ba1a557b6ccd
parent 50204 3195a713e24d
child 54483 ac20c3bdc55d
--- a/src/java.base/share/classes/sun/security/util/SignatureUtil.java	Tue Dec 18 16:36:26 2018 -0800
+++ b/src/java.base/share/classes/sun/security/util/SignatureUtil.java	Wed Dec 19 02:27:44 2018 +0000
@@ -28,8 +28,6 @@
 import java.io.IOException;
 import java.security.*;
 import java.security.spec.*;
-import sun.security.util.ObjectIdentifier;
-import sun.security.x509.AlgorithmId;
 import sun.security.rsa.RSAUtil;
 
 /**
@@ -86,13 +84,12 @@
     // specified Signature object as signature parameters.
     public static void specialSetParameter(Signature sig, byte[] paramBytes)
             throws InvalidAlgorithmParameterException, ProviderException {
-
-        AlgorithmParameters params = null;
         if (paramBytes != null) {
             String sigName = sig.getAlgorithm();
-            params = createAlgorithmParameters(sigName, paramBytes);
+            AlgorithmParameters params =
+                createAlgorithmParameters(sigName, paramBytes);
+            specialSetParameter(sig, params);
         }
-        specialSetParameter(sig, params);
     }
 
     // Special method for setting the specified AlgorithmParameter object
@@ -100,16 +97,9 @@
     public static void specialSetParameter(Signature sig,
             AlgorithmParameters params)
             throws InvalidAlgorithmParameterException, ProviderException {
-
-        String sigName = sig.getAlgorithm();
         if (params != null) {
+            String sigName = sig.getAlgorithm();
             sig.setParameter(getParamSpec(sigName, params));
-        } else {
-            try {
-                sig.setParameter(null);
-            } catch (UnsupportedOperationException e) {
-                // ignore for maintaining backward compatibility
-            }
         }
     }
 }