@Override public String toString() { return String.format( "[%s@%d::resultCode=%s, matchedDn=%s, responseControls=%s, " + "referralURLs=%s, messageId=%s, message=%s, providerException=%s]", getClass().getName(), hashCode(), resultCode, matchedDn, Arrays.toString(responseControls), Arrays.toString(referralURLs), messageId, getMessage(), getCause()); } }
@Override public String toString() { return String.format( "[%s@%d::resultCode=%s, matchedDn=%s, responseControls=%s, " + "referralURLs=%s, messageId=%s, message=%s, providerException=%s]", getClass().getName(), hashCode(), resultCode, matchedDn, Arrays.toString(responseControls), Arrays.toString(referralURLs), messageId, getMessage(), getCause()); } }
@Override public String toString() { return String.format( "[%s@%d::resultCode=%s, matchedDn=%s, responseControls=%s, " + "referralURLs=%s, messageId=%s, message=%s, providerException=%s]", getClass().getName(), hashCode(), resultCode, matchedDn, Arrays.toString(responseControls), Arrays.toString(referralURLs), messageId, getMessage(), getCause()); } }
public static String format(final Throwable t) { Throwable throwable = t; if (IllegalStateException.class.isInstance(throwable)) { throwable = throwable.getCause(); } final Throwable rootCause = ExceptionUtils.getRootCause(throwable) == null ? throwable : ExceptionUtils.getRootCause(throwable); String exceptionSimpleName = rootCause.getClass().getSimpleName(); String message = rootCause.getMessage(); if (LdapException.class.isInstance(throwable)) { LdapException le = LdapException.class.cast(throwable); // unwrap underlying exception if appropriate exceptionSimpleName = le.getCause() == null ? le.getClass().getSimpleName() : le.getCause().getClass().getSimpleName(); if (LdapReferralException.class.isInstance(le.getCause())) { final LdapReferralException ldapReferralException = LdapReferralException.class.cast(le.getCause()); message = "Referral error, remaining name '" + ldapReferralException.getRemainingName().toString() + "'"; } if (NameNotFoundException.class.isInstance(le.getCause())) { final NameNotFoundException nameNotFoundException = NameNotFoundException.class.cast(le.getCause()); message = "Name not found error, remaining name '" + nameNotFoundException.getRemainingName().toString() + "'"; } final StringBuilder sb = new StringBuilder(); sb.append("[").append(exceptionSimpleName).append("] "); sb.append(message); if (le.getResultCode() != null) { sb.append(" [result code = ").append(le.getResultCode().name()).append("]"); } return sb.toString(); } return "Error occurred: [" + exceptionSimpleName + "] " + message; }