src/java.naming/share/classes/sun/security/provider/certpath/ldap/JdkLDAP.java

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

*** 25,39 **** package sun.security.provider.certpath.ldap; import java.util.HashMap; import java.util.List; ! import java.security.Provider; ! import java.security.NoSuchAlgorithmException; ! import java.security.InvalidParameterException; ! import java.security.InvalidAlgorithmParameterException; ! import java.security.ProviderException; import java.security.cert.CertStoreParameters; /** * Provider class for the JdkLDAP provider. * Supports LDAP cert store. --- 25,35 ---- package sun.security.provider.certpath.ldap; import java.util.HashMap; import java.util.List; ! import java.security.*; import java.security.cert.CertStoreParameters; /** * Provider class for the JdkLDAP provider. * Supports LDAP cert store.
*** 73,90 **** } public JdkLDAP() { super("JdkLDAP", 1.9d, "JdkLDAP Provider (implements LDAP CertStore)"); HashMap<String, String> attrs = new HashMap<>(2); attrs.put("LDAPSchema", "RFC2587"); attrs.put("ImplementedIn", "Software"); /* * CertStore * attrs: LDAPSchema, ImplementedIn */ ! putService(new ProviderService(this, "CertStore", "LDAP", "sun.security.provider.certpath.ldap.LDAPCertStore", null, attrs)); } } --- 69,92 ---- } public JdkLDAP() { super("JdkLDAP", 1.9d, "JdkLDAP Provider (implements LDAP CertStore)"); + final Provider p = this; + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { HashMap<String, String> attrs = new HashMap<>(2); attrs.put("LDAPSchema", "RFC2587"); attrs.put("ImplementedIn", "Software"); /* * CertStore * attrs: LDAPSchema, ImplementedIn */ ! putService(new ProviderService(p, "CertStore", "LDAP", "sun.security.provider.certpath.ldap.LDAPCertStore", null, attrs)); + return null; } + }); + } }