Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 93618 invoked from network); 28 Nov 2005 16:48:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Nov 2005 16:48:42 -0000 Received: (qmail 25513 invoked by uid 500); 28 Nov 2005 16:48:39 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 25475 invoked by uid 500); 28 Nov 2005 16:48:39 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 25464 invoked by uid 99); 28 Nov 2005 16:48:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Nov 2005 08:48:39 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 28 Nov 2005 08:50:09 -0800 Received: (qmail 93175 invoked by uid 65534); 28 Nov 2005 16:48:18 -0000 Message-ID: <20051128164818.93173.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r349425 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java Date: Mon, 28 Nov 2005 16:48:17 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Mon Nov 28 08:48:13 2005 New Revision: 349425 URL: http://svn.apache.org/viewcvs?rev=349425&view=rev Log: added a toString method for debugging purpose Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java?rev=349425&r1=349424&r2=349425&view=diff ============================================================================== --- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java (original) +++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java Mon Nov 28 08:48:13 2005 @@ -276,4 +276,228 @@ return true; } + + /** + * Get a String representation of a LdapResult + * + * @return A LdapResult String + */ + public String toString() + { + + StringBuffer sb = new StringBuffer(); + + sb.append( " Ldap Result\n" ); + sb.append( " Result code : (" ).append( resultCode ).append( ')' ); + + if ( resultCode != null ) + { + + if ( resultCode.getValue() == ResultCodeEnum.SUCCESS_VAL ) + { + sb.append( " success\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.OPERATIONSERROR_VAL ) + { + sb.append( " operationsError\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.PROTOCOLERROR_VAL ) + { + sb.append( " protocolError\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.TIMELIMITEXCEEDED_VAL ) + { + sb.append( " timeLimitExceeded\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.SIZELIMITEXCEEDED_VAL ) + { + sb.append( " sizeLimitExceeded\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.COMPAREFALSE_VAL ) + { + sb.append( " compareFalse\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.COMPARETRUE_VAL ) + { + sb.append( " compareTrue\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.AUTHMETHODNOTSUPPORTED_VAL ) + { + sb.append( " authMethodNotSupported\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.STRONGAUTHREQUIRED_VAL ) + { + sb.append( " strongAuthRequired\n" ); + } + else if ( resultCode.getValue() == 9 ) + { + sb.append( " -- 9 reserved --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.REFERRAL_VAL ) + { + sb.append( " referral -- new\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.ADMINLIMITEXCEEDED_VAL ) + { + sb.append( " adminLimitExceeded -- new\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.UNAVAILABLECRITICALEXTENSION_VAL ) + { + sb.append( " unavailableCriticalExtension -- new\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.CONFIDENTIALITYREQUIRED_VAL ) + { + sb.append( " confidentialityRequired -- new\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.SASLBINDINPROGRESS_VAL ) + { + sb.append( " saslBindInProgress -- new\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.NOSUCHATTRIBUTE_VAL ) + { + sb.append( " noSuchAttribute\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.UNDEFINEDATTRIBUTETYPE_VAL ) + { + sb.append( " undefinedAttributeType\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.INAPPROPRIATEMATCHING_VAL ) + { + sb.append( " inappropriateMatching\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.CONSTRAINTVIOLATION_VAL ) + { + sb.append( " constraintViolation\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.ATTRIBUTEORVALUEEXISTS_VAL ) + { + sb.append( " attributeOrValueExists\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.INVALIDATTRIBUTESYNTAX_VAL ) + { + sb.append( " invalidAttributeSyntax\n" ); + } + else if ( ( resultCode.getValue() >= 22 ) && ( resultCode.getValue() <= 31 ) ) + { + sb.append( " -- 22-31 unused --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.NOSUCHOBJECT_VAL ) + { + sb.append( " noSuchObject\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.ALIASPROBLEM_VAL ) + { + sb.append( " aliasProblem\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.INVALIDDNSYNTAX_VAL ) + { + sb.append( " invalidDNSyntax\n" ); + } + else if ( resultCode.getValue() == 35 ) + { + sb.append( " -- 35 reserved for undefined isLeaf --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM_VAL ) + { + sb.append( " aliasDereferencingProblem\n" ); + } + else if ( ( resultCode.getValue() >= 37 ) && ( resultCode.getValue() <= 47 ) ) + { + sb.append( " -- 37-47 unused --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.INAPPROPRIATEAUTHENTICATION_VAL ) + { + sb.append( " inappropriateAuthentication\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.INVALIDCREDENTIALS_VAL ) + { + sb.append( " invalidCredentials\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.INSUFFICIENTACCESSRIGHTS_VAL ) + { + sb.append( " insufficientAccessRights\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.BUSY_VAL ) + { + sb.append( " busy\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.UNAVAILABLE_VAL ) + { + sb.append( " unavailable\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.UNWILLINGTOPERFORM_VAL ) + { + sb.append( " unwillingToPerform\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.LOOPDETECT_VAL ) + { + sb.append( " loopDetect\n" ); + } + else if ( ( resultCode.getValue() >= 55 ) && ( resultCode.getValue() <= 63 ) ) + { + sb.append( " -- 55-63 unused --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.NAMINGVIOLATION_VAL ) + { + sb.append( " namingViolation\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.OBJECTCLASSVIOLATION_VAL ) + { + sb.append( " objectClassViolation\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.NOTALLOWEDONNONLEAF_VAL ) + { + sb.append( " notAllowedOnNonLeaf\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.NOTALLOWEDONRDN_VAL ) + { + sb.append( " notAllowedOnRDN\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.ENTRYALREADYEXISTS_VAL ) + { + sb.append( " entryAlreadyExists\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.OBJECTCLASSMODSPROHIBITED_VAL ) + { + sb.append( " objectClassModsProhibited\n" ); + } + else if ( resultCode.getValue() == 70 ) + { + sb.append( " -- 70 reserved for CLDAP --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.AFFECTSMULTIPLEDSAS_VAL ) + { + sb.append( " affectsMultipleDSAs -- new\n" ); + } + else if ( ( resultCode.getValue() >= 72 ) && ( resultCode.getValue() <= 79 ) ) + { + sb.append( " -- 72-79 unused --\n" ); + } + else if ( resultCode.getValue() == ResultCodeEnum.OTHER_VAL ) + { + sb.append( " other\n" ); + } + else if ( ( resultCode.getValue() >= 81 ) && ( resultCode.getValue() <= 90 ) ) + { + sb.append( " -- 81-90 reserved for APIs --" ); + } + else + { + sb.append( "Unknown error code : " ).append( resultCode ); + } + } + + sb.append( " Matched DN : '" ).append( matchedDn ).append( "'\n" ); + sb.append( " Error message : '" ).append( errorMessage ).append( "'\n" ); + + if ( referral != null ) + { + sb.append( " Referrals :\n" ); + + sb.append( " Referral :" ).append( referral.toString() ) + .append( '\n' ); + } + + return sb.toString(); + } }