cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1380544 - /cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/TrustedIssuer.java
Date Tue, 04 Sep 2012 10:56:53 GMT
Author: coheigea
Date: Tue Sep  4 10:56:53 2012
New Revision: 1380544

URL: http://svn.apache.org/viewvc?rev=1380544&view=rev
Log:
Improve error messages in TrustedIssuer to show what was configured

Modified:
    cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/TrustedIssuer.java

Modified: cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/TrustedIssuer.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/TrustedIssuer.java?rev=1380544&r1=1380543&r2=1380544&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/TrustedIssuer.java
(original)
+++ cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/config/TrustedIssuer.java
Tue Sep  4 10:56:53 2012
@@ -23,7 +23,7 @@ import org.apache.cxf.fediz.core.config.
 import org.apache.cxf.fediz.core.config.jaxb.ValidationType;
 
 public class TrustedIssuer {
-    private TrustedIssuerType trustedIssuerType;
+    private final TrustedIssuerType trustedIssuerType;
 
         
     public TrustedIssuer(TrustedIssuerType trustedIssuerType) {
@@ -48,22 +48,31 @@ public class TrustedIssuer {
     }
 
     public CertificateValidationMethod getCertificateValidationMethod() {
-        if (ValidationType.CHAIN_TRUST.equals(trustedIssuerType.getCertificateValidation()))
{
+        ValidationType certificateValidation = trustedIssuerType.getCertificateValidation();
+        if (ValidationType.CHAIN_TRUST.equals(certificateValidation)) {
             return CertificateValidationMethod.CHAIN_TRUST;
-        } else if (ValidationType.PEER_TRUST.equals(trustedIssuerType.getCertificateValidation()))
{
+        } else if (ValidationType.PEER_TRUST.equals(certificateValidation)) {
             return CertificateValidationMethod.PEER_TRUST;
         } else {
-            throw new IllegalStateException("Not supported certificate validation type");
+            throw new IllegalStateException(
+                    "Not supported certificate validation type: " + certificateValidation.value()
+            );
         }
     }
     
-    public void setCertificateValidationMethod(CertificateValidationMethod validationMethod)
{
+    public void setCertificateValidationMethod(
+            final CertificateValidationMethod validationMethod
+    ) {
         if (CertificateValidationMethod.CHAIN_TRUST.equals(validationMethod)) {
             trustedIssuerType.setCertificateValidation(ValidationType.CHAIN_TRUST);
         } else if (CertificateValidationMethod.PEER_TRUST.equals(validationMethod)) {
             trustedIssuerType.setCertificateValidation(ValidationType.PEER_TRUST);
         } else {
-            throw new IllegalStateException("Not supported certificate validation type");
+            String error = "Not supported certificate validation type";
+            if (validationMethod != null) {
+                error += ": " + validationMethod.value(); 
+            }
+            throw new IllegalStateException(error);
         }
     }
     



Mime
View raw message