directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r328305 - /directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/BindRequestImpl.java
Date Tue, 25 Oct 2005 07:51:08 GMT
Author: elecharny
Date: Tue Oct 25 00:51:04 2005
New Revision: 328305

URL: http://svn.apache.org/viewcvs?rev=328305&view=rev
Log:
Added a toString() method

Modified:
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/BindRequestImpl.java

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/BindRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/BindRequestImpl.java?rev=328305&r1=328304&r2=328305&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/BindRequestImpl.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/BindRequestImpl.java
Tue Oct 25 00:51:04 2005
@@ -17,6 +17,7 @@
 package org.apache.ldap.common.message;
 
 
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.util.ArrayUtils;
 
 
@@ -290,5 +291,51 @@
 
 
         return true;
+    }
+
+    /**
+     * Get a String representation of a BindRequest
+     *
+     * @return A BindRequest String 
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    BindRequest\n" );
+        sb.append( "        Version : '" ).append( isVersion3 ? "3" : "2" ).append( "'\n"
);
+
+        if ( StringUtils.isEmpty( name.toString() ) )
+        {
+            sb.append( "        Name : anonymous\n" );
+        }
+        else
+        {
+            sb.append( "        Name : '" ).append( name.toString() ).append( "'\n" );
+    
+            if ( isSimple )
+            {
+                sb.append( "        Simple authentication : '" )
+                  .append( StringUtils.toUtf8( credentials) )
+                  .append('/')
+                  .append( StringUtils.dumpBytes( credentials ) )
+                  .append( "'\n" );
+            }
+            else
+            {
+                sb.append( "        Sasl credentials\n" );
+                sb.append( "            Mechanism :'" )
+                .append( mechanism )
+                .append( "'\n" );
+                
+                sb.append( "            Credentials : '" )
+                .append( StringUtils.toUtf8( credentials) )
+                .append('/')
+                .append( StringUtils.dumpBytes( credentials ) )
+                .append( "'\n" );
+            }
+        }
+        
+        return sb.toString();
     }
 }



Mime
View raw message