From 58d668e476b45ccdac9fce119f398d151d292ebe Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Tue, 11 Sep 2007 12:50:16 +0000
Subject: [PATCH] Fix for issue #2240

---
 opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ApplicationTrustManager.java |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ApplicationTrustManager.java b/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ApplicationTrustManager.java
index cf2f9ec..5b35b98 100644
--- a/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ApplicationTrustManager.java
+++ b/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ApplicationTrustManager.java
@@ -163,7 +163,10 @@
       lastRefusedChain = chain;
       lastRefusedAuthType = authType;
       lastRefusedCause = Cause.NOT_TRUSTED;
-      throw ce;
+      OpendsCertificationException e = new OpendsCertificationException(
+          chain);
+      e.initCause(ce);
+      throw e;
     }
 
     if (!explicitlyAccepted)
@@ -177,7 +180,10 @@
         lastRefusedChain = chain;
         lastRefusedAuthType = authType;
         lastRefusedCause = Cause.HOST_NAME_MISMATCH;
-        throw ce;
+        OpendsCertificationException e = new OpendsCertificationException(
+            chain);
+        e.initCause(ce);
+        throw e;
       }
     }
   }
@@ -214,7 +220,9 @@
       lastRefusedChain = chain;
       lastRefusedAuthType = authType;
       lastRefusedCause = Cause.NOT_TRUSTED;
-      throw ce;
+      OpendsCertificationException e = new OpendsCertificationException(chain);
+      e.initCause(ce);
+      throw e;
     }
 
     if (!explicitlyAccepted)
@@ -228,7 +236,10 @@
         lastRefusedChain = chain;
         lastRefusedAuthType = authType;
         lastRefusedCause = Cause.HOST_NAME_MISMATCH;
-        throw ce;
+        OpendsCertificationException e = new OpendsCertificationException(
+            chain);
+        e.initCause(ce);
+        throw e;
       }
     }
   }
@@ -334,8 +345,8 @@
     }
     if (!found)
     {
-      throw new CertificateException(
-          "Certificate not in list of accepted certificates");
+      throw new OpendsCertificationException(
+          "Certificate not in list of accepted certificates", chain);
     }
   }
 
@@ -368,8 +379,10 @@
 
       if (!matches)
       {
-        throw new CertificateException("Hostname mismatch between host name "+
-            host+" and subject DN: "+chain[0].getSubjectX500Principal());
+        throw new OpendsCertificationException(
+            "Hostname mismatch between host name " + host
+                + " and subject DN: " + chain[0].getSubjectX500Principal(),
+            chain);
       }
     }
   }

--
Gitblit v1.10.0