You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2019/03/14 13:17:11 UTC

[GitHub] [knox] rlevas commented on a change in pull request #72: KNOX-1820 - Cleanup KeystoreService implementations and add unit tests

rlevas commented on a change in pull request #72: KNOX-1820 - Cleanup KeystoreService implementations and add unit tests
URL: https://github.com/apache/knox/pull/72#discussion_r265562283
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java
 ##########
 @@ -442,23 +450,24 @@ public String getKeystorePath() {
    * <p>
    * if <code>failIfNotAccessible</code> is <code>true</code>, then the path to the keystore file
    * (keystorePath) is validated such that it exists, is a file and can be read by the process. If
-   * any of these checks fail, a {@link KeystoreServiceException} is thrown in dicatating the exact
+   * any of these checks fail, a {@link KeystoreServiceException} is thrown in dictating the exact
    * reason.
    * <p>
    * Before the keystore file is loaded, the service's read lock is locked to prevent concurrent
    * reads on the file.
    *
    * @param keystorePath        the path to the keystore file
    * @param keystoreType        the type of keystore file
-   * @param alias               the alias for the password to the keystore file (see {@link #getKeystorePassword(String)})
+   * @param alias               the alias for the password to the keystore file (see {@link #getKeyStorePassword(String)})
    * @param failIfNotAccessible <code>true</code> to ensure the keystore file exists and is readable; <code>false</code> to not check
    * @return a {@link KeyStore}, or <code>null</code> if the requested keystore cannot be created
    * @throws KeystoreServiceException if an error occurs loading the keystore file
    */
   private KeyStore getKeystore(Path keystorePath, String keystoreType, String alias, boolean failIfNotAccessible) throws KeystoreServiceException {
-    File keystoreFile = keystorePath.toFile();
 
     if (failIfNotAccessible) {
+      File keystoreFile = keystorePath.toFile();
 
 Review comment:
   I though about switching to `Files.exists(keystorePath)`, but the code looked more cumbersome. I can change to make it all consistent with the nio package. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services