src/java.base/share/classes/sun/security/tools/keytool/Main.java

Print this page
7191662: JCE providers should be located via ServiceLoader

@@ -727,23 +727,20 @@
                 } else {
                     provClass = Class.forName(provName);
                 }
 
                 String provArg = provider.snd;
-                Object obj;
-                if (provArg == null) {
-                    obj = provClass.newInstance();
-                } else {
-                    Constructor<?> c = provClass.getConstructor(PARAM_STRING);
-                    obj = c.newInstance(provArg);
-                }
+                Object obj = provClass.newInstance();
                 if (!(obj instanceof Provider)) {
                     MessageFormat form = new MessageFormat
                         (rb.getString("provName.not.a.provider"));
                     Object[] source = {provName};
                     throw new Exception(form.format(source));
                 }
+                if (provArg != null) {
+                    obj = ((Provider) obj).configure(provArg);
+                }
                 Security.addProvider((Provider)obj);
             }
         }
 
         if (command == LIST && verbose && rfc) {