From eecab0a5276278740ac9070c83e24641986210e5 Mon Sep 17 00:00:00 2001 From: weijun Date: Tue, 17 Jul 2018 22:22:00 +0800 Subject: [PATCH] 8207318: KeyStore#getInstance(File, LoadStoreParameter) does not load the keystore Reviewed-by: mullan --- src/java.base/share/classes/java/security/KeyStore.java | 1 + test/jdk/java/security/KeyStore/ProbeKeystores.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/security/KeyStore.java b/src/java.base/share/classes/java/security/KeyStore.java index 8353347204..6fc7282111 100644 --- a/src/java.base/share/classes/java/security/KeyStore.java +++ b/src/java.base/share/classes/java/security/KeyStore.java @@ -1807,6 +1807,7 @@ public class KeyStore { keystore.load(dataStream, password); } else { keystore.keyStoreSpi.engineLoad(dataStream, param); + keystore.initialized = true; } return keystore; } diff --git a/test/jdk/java/security/KeyStore/ProbeKeystores.java b/test/jdk/java/security/KeyStore/ProbeKeystores.java index 76d1da5950..c6abe8389e 100644 --- a/test/jdk/java/security/KeyStore/ProbeKeystores.java +++ b/test/jdk/java/security/KeyStore/ProbeKeystores.java @@ -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 @@ public class ProbeKeystores { 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 @@ public class ProbeKeystores { 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 -- GitLab