From 97639772fe931bece28995b568a8c8f7fd2b93a8 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Wed, 25 Sep 2013 07:31:13 +0000
Subject: [PATCH] Fix OPENDJ-18 - keystore import failes due to empty PIN Review CR-2353

---
 opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java b/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
index d2a89e7..dbd185b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
@@ -60,7 +60,6 @@
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.util.ServerConstants.*;
 
-
 /**
  * This class defines a number of static utility methods that may be used
  * throughout the server.  Note that because of the frequency with which these
@@ -1746,7 +1745,30 @@
     return buffer.toString();
   }
 
+  /**
+   * Check if the stack trace of provided exception contains a given cause.
+   *
+   * @param throwable
+   *          exception that may contain the cause
+   * @param searchedCause
+   *          class of the cause to look for. Any subclass will match.
+   * @return true if and only if the given cause is found as a cause of any
+   *         level in the provided exception.
+   */
+  public static boolean stackTraceContainsCause(
+      Throwable throwable, Class<? extends Throwable> searchedCause)
+  {
+    Throwable t = throwable;
+    while ((t = t.getCause()) != null)
+    {
+      if (searchedCause.isAssignableFrom(t.getClass()))
+      {
+        return true;
+      }
 
+    }
+    return false;
+  }
 
   /**
    * Appends a string representation of the stack trace for the provided

--
Gitblit v1.10.0