changeset 51805:9502e3b9d415

8207318: KeyStore#getInstance(File, LoadStoreParameter) does not load the keystore Reviewed-by: mullan
author weijun
date Tue, 17 Jul 2018 22:22:00 +0800
parents d379f06962cf
children 8a07817a6c57
files src/java.base/share/classes/java/security/KeyStore.java test/jdk/java/security/KeyStore/ProbeKeystores.java
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/security/KeyStore.java	Tue Jul 17 09:37:24 2018 -0400
+++ b/src/java.base/share/classes/java/security/KeyStore.java	Tue Jul 17 22:22:00 2018 +0800
@@ -1807,6 +1807,7 @@
                     keystore.load(dataStream, password);
                 } else {
                     keystore.keyStoreSpi.engineLoad(dataStream, param);
+                    keystore.initialized = true;
                 }
                 return keystore;
             }
--- a/test/jdk/java/security/KeyStore/ProbeKeystores.java	Tue Jul 17 09:37:24 2018 -0400
+++ b/test/jdk/java/security/KeyStore/ProbeKeystores.java	Tue Jul 17 22:22:00 2018 +0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8044445 8194307
+ * @bug 8044445 8194307 8207318
  * @summary test new methods from JEP-229: Create PKCS12 Keystores by Default
  */
 
@@ -180,7 +180,8 @@
             throw new Exception("ERROR: expected a " + type + " keystore, " +
                 "got a " + ks.getType() + " keystore instead");
         } else {
-            System.out.println("Probed a " + type + " keystore named '" + file + "'");
+            System.out.println("Probed a " + type + " keystore named '" + file
+                    + "' with " + ks.size() + " entries");
         }
 
         // Next try with an incorrect password
@@ -197,7 +198,8 @@
             throw new Exception("ERROR: expected a " + type + " keystore, " +
                 "got a " + ks.getType() + " keystore instead");
         } else {
-            System.out.println("Probed a " + type + " keystore named '" + file + "'");
+            System.out.println("Probed a " + type + " keystore named '" + file
+                    + "' with " + ks.size() + " entries");
         }
 
         // Next try with an incorrect password within a LoadStoreParameter