You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/11/28 17:48:17 UTC

svn commit: r349425 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/LdapResultImpl.java

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();
+    }
 }