jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/UcryptoProvider.java
changeset 41550 563c1d911dcb
parent 40416 5d91b2fd668c
equal deleted inserted replaced
41481:c8cfe3a01e7d 41550:563c1d911dcb
    48 
    48 
    49     static {
    49     static {
    50         try {
    50         try {
    51             // cannot use LoadLibraryAction because that would make the native
    51             // cannot use LoadLibraryAction because that would make the native
    52             // library available to the bootclassloader, but we run in the
    52             // library available to the bootclassloader, but we run in the
    53             // extension classloader.
    53             // platform classloader.
    54             String osname = System.getProperty("os.name");
    54             provProp = AccessController.doPrivileged
    55             if (osname.startsWith("SunOS")) {
    55                 (new PrivilegedAction<>() {
    56                 provProp = AccessController.doPrivileged
    56                     @Override
    57                     (new PrivilegedAction<HashMap<String, ServiceDesc>>() {
    57                     public HashMap<String, ServiceDesc> run() {
    58                         public HashMap<String, ServiceDesc> run() {
    58                         String osname = System.getProperty("os.name");
       
    59                         if (osname.startsWith("SunOS")) {
    59                             try {
    60                             try {
    60                                 DEBUG = Boolean.parseBoolean(System.getProperty("com.oracle.security.ucrypto.debug"));
    61                                 DEBUG = Boolean.parseBoolean(System.getProperty("com.oracle.security.ucrypto.debug"));
    61                                 String javaHome = System.getProperty("java.home");
    62                                 String javaHome = System.getProperty("java.home");
    62                                 String sep = System.getProperty("file.separator");
    63                                 String sep = System.getProperty("file.separator");
    63                                 defConfigName = javaHome + sep + "conf" + sep + "security" + sep +
    64                                 defConfigName = javaHome + sep + "conf" + sep + "security" + sep +
    64                                     "ucrypto-solaris.cfg";
    65                                     "ucrypto-solaris.cfg";
    65                                 System.loadLibrary("j2ucrypto");
    66                                 System.loadLibrary("j2ucrypto");
    66                                 return new HashMap<>();
    67                                 return new HashMap<>();
    67                             } catch (Error err) {
    68                             } catch (Error err) {
    68                                 if (DEBUG) err.printStackTrace();
    69                                 if (DEBUG) err.printStackTrace();
    69                                 return null;
       
    70                             } catch (SecurityException se) {
    70                             } catch (SecurityException se) {
    71                                 if (DEBUG) se.printStackTrace();
    71                                 if (DEBUG) se.printStackTrace();
    72                                 return null;
       
    73                             }
    72                             }
    74                         }
    73                         }
    75                     });
    74                         return null;
    76             }
    75                     }
       
    76                 });
    77             if (provProp != null) {
    77             if (provProp != null) {
    78                 boolean[] result = loadLibraries();
    78                 boolean[] result = loadLibraries();
    79                 if (result.length == 2) {
    79                 if (result.length == 2) {
    80                     // true when libsoftcrypto or libucrypto(S12) has been successfully loaded
    80                     // true when libsoftcrypto or libucrypto(S12) has been successfully loaded
    81                     if (result[1]) {
    81                     if (result[1]) {