src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Secmod.java
changeset 48248 55b9b1e184c6
parent 47216 71c04702a3d5
child 50773 4bf4c7918063
equal deleted inserted replaced
48247:fa5a47cad0c9 48248:55b9b1e184c6
   194             }
   194             }
   195             platformPath = platformFile.getPath();
   195             platformPath = platformFile.getPath();
   196         }
   196         }
   197 
   197 
   198         if (configDir != null) {
   198         if (configDir != null) {
   199             File configBase = new File(configDir);
   199             String configDirPath = null;
       
   200             String sqlPrefix = "sql:/";
       
   201             if (!configDir.startsWith(sqlPrefix)) {
       
   202                 configDirPath = configDir;
       
   203             } else {
       
   204                 StringBuilder configDirPathSB = new StringBuilder(configDir);
       
   205                 configDirPath = configDirPathSB.substring(sqlPrefix.length());
       
   206             }
       
   207             File configBase = new File(configDirPath);
   200             if (configBase.isDirectory() == false ) {
   208             if (configBase.isDirectory() == false ) {
   201                 throw new IOException("configDir must be a directory: " + configDir);
   209                 throw new IOException("configDir must be a directory: " + configDirPath);
   202             }
   210             }
   203             File secmodFile = new File(configBase, "secmod.db");
   211             if (!configDir.startsWith(sqlPrefix)) {
   204             if (secmodFile.isFile() == false) {
   212                 File secmodFile = new File(configBase, "secmod.db");
   205                 throw new FileNotFoundException(secmodFile.getPath());
   213                 if (secmodFile.isFile() == false) {
       
   214                     throw new FileNotFoundException(secmodFile.getPath());
       
   215                 }
   206             }
   216             }
   207         }
   217         }
   208 
   218 
   209         if (DEBUG) System.out.println("lib: " + platformPath);
   219         if (DEBUG) System.out.println("lib: " + platformPath);
   210         nssHandle = nssLoadLibrary(platformPath);
   220         nssHandle = nssLoadLibrary(platformPath);