Fix for failing to load the validation key after an initial failure
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/d65d3978 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/d65d3978 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/d65d3978 Branch: refs/heads/master Commit: d65d3978e46c81fb79997f58bcca8528baf3c6f9 Parents: 82f7a57 Author: Colm O hEigeartaigh <[email protected]> Authored: Mon Apr 11 17:18:36 2016 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Mon Apr 11 17:18:36 2016 +0100 ---------------------------------------------------------------------- .../org/apache/cxf/fediz/core/config/FedizContext.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/d65d3978/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizContext.java ---------------------------------------------------------------------- diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizContext.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizContext.java index d67d49b..123d463 100644 --- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizContext.java +++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizContext.java @@ -26,6 +26,7 @@ import java.math.BigInteger; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Properties; @@ -63,7 +64,7 @@ public class FedizContext implements Closeable { private String relativePath; private ReplayCache replayCache; private Protocol protocol; - private List<TrustManager> certificateStores; + private List<TrustManager> certificateStores = new ArrayList<>(); private KeyManager keyManager; private KeyManager decryptionKeyManager; private ClassLoader classloader; @@ -97,10 +98,10 @@ public class FedizContext implements Closeable { } public List<TrustManager> getCertificateStores() { - if (certificateStores != null) { - return certificateStores; + if (!certificateStores.isEmpty()) { + return Collections.unmodifiableList(certificateStores); } - certificateStores = new ArrayList<>(); + CertificateStores certStores = config.getCertificateStores(); List<TrustManagersType> trustManagers = certStores.getTrustManager(); for (TrustManagersType manager : trustManagers) { @@ -126,7 +127,7 @@ public class FedizContext implements Closeable { throw new RuntimeException("Failed to read keystore"); } } - return certificateStores; + return Collections.unmodifiableList(certificateStores); } public BigInteger getMaximumClockSkew() {
