public static LdapException newLdapException(ResultCode resultCode,CharSequence diagnosticMessage,Throwable cause){
  final Result result=Responses.newResult(resultCode);
  if (diagnosticMessage != null) {
    result.setDiagnosticMessage(diagnosticMessage.toString());
  }
 else   if (cause != null) {
    result.setDiagnosticMessage(cause.getLocalizedMessage());
  }
  result.setCause(cause);
  return newLdapException(result);
}

public static LdapException newLdapException ( ResultCode resultCode , CharSequence diagnosticMessage , Throwable cause ) { final Result result = Responses . newResult ( resultCode ) ; if ( diagnosticMessage != null ) { result . setDiagnosticMessage ( diagnosticMessage . toString ( ) ) ; } else if ( cause != null ) { result . setDiagnosticMessage ( cause . getLocalizedMessage ( ) ) ; } result . setCause ( cause ) ; return newLdapException ( result ) ; }
creates a new ldap exception with the provided result code , diagnostic message , and cause .
