summaryrefslogtreecommitdiff
path: root/bkucommon/src/main/java
diff options
context:
space:
mode:
authortkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2012-05-30 15:47:13 +0000
committertkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2012-05-30 15:47:13 +0000
commit0ecfd783645a581d9859dab90e9ddf14b4b55232 (patch)
tree505ec5090a2e31c9203d62220a596f2ec8834b93 /bkucommon/src/main/java
parenta804f469a68d762af10bd2779d8bd4c617890127 (diff)
downloadmocca-0ecfd783645a581d9859dab90e9ddf14b4b55232.tar.gz
mocca-0ecfd783645a581d9859dab90e9ddf14b4b55232.tar.bz2
mocca-0ecfd783645a581d9859dab90e9ddf14b4b55232.zip
Correct cast of certificate array
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1087 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon/src/main/java')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java
index a2a83ca1..076fdf11 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java
@@ -37,6 +37,7 @@ import iaik.pki.store.truststore.TrustStoreFactory;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Date;
+import java.util.Set;
import javax.net.ssl.X509TrustManager;
@@ -148,13 +149,16 @@ public class PKITrustManager implements X509TrustManager {
try {
TrustStore trustStore = TrustStoreFactory.getInstance(pkiProfile.getTrustStoreProfile(), tid);
- return (X509Certificate[]) trustStore.getTrustedCertificates(tid).toArray();
-
+ @SuppressWarnings("unchecked")
+ Set<X509Certificate> certs = trustStore.getTrustedCertificates(tid);
+ return certs.toArray(new X509Certificate[certs.size()]);
} catch (TrustStoreException e) {
log.warn("Failed to get list of accepted issuers.", e);
return new X509Certificate[] {};
+ } catch (ClassCastException e) {
+ log.error("Failed to cast list of accepted issuers.", e);
+ return new X509Certificate[] {};
}
-
}
private static iaik.x509.X509Certificate[] convertCerts(