private static Throwable stripException()

in dekaf-inter/src/exceptions/DBException.java [77:101]


  private static Throwable stripException(final Throwable e) {
    if (e == null) return null;

    String className = e.getClass().getName();
    boolean classOk = e instanceof DBException
                   || className.startsWith("java.")
                   || className.startsWith("javax.")
                   || className.startsWith("sun.jdbc.odbc.");

    Throwable originalCause = e.getCause();
    Throwable strippedCause = stripException(originalCause);
    boolean causeOk = originalCause == strippedCause;

    if (classOk && causeOk) return e;

    Throwable strippedException;
    if (e instanceof SQLException) {
      strippedException = new StrippedSQLException((SQLException) e, strippedCause);
    }
    else {
      strippedException = new StrippedUnknownException(e, strippedCause);
    }

    return strippedException;
  }