directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r479581 - in /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap: codec/ codec/add/ codec/bind/ codec/compare/ codec/del/ codec/extended/ codec/extended/operations/ codec/modify/ codec/modifyDn/ codec/search...
Date Mon, 27 Nov 2006 10:49:00 GMT
Author: elecharny
Date: Mon Nov 27 02:48:58 2006
New Revision: 479581

URL: http://svn.apache.org/viewvc?view=rev&rev=479581
Log:
Added some defensive code to avoid NPE in DEBUG mode. Added a method in StringTools to dump
Objects

Modified:
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResponse.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindResponse.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SaslCredentials.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdown.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
Mon Nov 27 02:48:58 2006
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.shared.ldap.codec;
 
+import org.apache.directory.shared.ldap.util.StringTools;
+
 
 /**
  * A class to store an attribute value assertion. 
@@ -92,7 +94,6 @@
         this.attributeDesc = attributeDesc;
     }
 
-
     /**
      * Get a String representation of an AttributeValueAssertion
      * 
@@ -105,8 +106,10 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( tabs ).append( "AttributeValueAssertion\n" );
-        sb.append( tabs ).append( "    Assertion description : '" ).append( attributeDesc.toString()
).append( "'\n" );
-        sb.append( tabs ).append( "    Assertion value : '" ).append( assertionValue.toString()
).append( "'\n" );
+        sb.append( tabs ).append( "    Assertion description : '" );
+        sb.append( attributeDesc != null ? attributeDesc : "null" );
+        sb.append( "'\n" );
+        sb.append( tabs ).append( "    Assertion value : '" ).append( StringTools.dumpObject(
assertionValue ) ).append( "'\n" );
 
         return sb.toString();
     }
@@ -124,7 +127,7 @@
 
         StringBuffer sb = new StringBuffer();
 
-        sb.append( attributeDesc.toString() );
+        sb.append( attributeDesc );
 
         switch ( filterType )
         {
@@ -145,7 +148,7 @@
                 break;
         }
 
-        sb.append( assertionValue.toString() );
+        sb.append( StringTools.dumpObject( assertionValue ) );
 
         return sb.toString();
     }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
Mon Nov 27 02:48:58 2006
@@ -296,7 +296,7 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "    Control\n" );
-        sb.append( "        Control type : '" ).append( controlType != null ? controlType.toString()
: "null" ).append(
+        sb.append( "        Control type : '" ).append( controlType ).append(
             "'\n" );
         sb.append( "        Criticality : '" ).append( criticality ).append( "'\n" );
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
Mon Nov 27 02:48:58 2006
@@ -661,13 +661,13 @@
 
         sb.append( "LdapMessage\n" );
         sb.append( "    message Id : " ).append( messageId ).append( '\n' );
-        sb.append( protocolOp.toString() );
+        sb.append( protocolOp );
 
         if ( controls != null )
         {
             for ( int i = 0; i < controls.size(); i++ )
             {
-                sb.append( ( ( Control ) controls.get( i ) ).toString() );
+                sb.append(  ( Control ) controls.get( i ) );
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResponse.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResponse.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResponse.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResponse.java
Mon Nov 27 02:48:58 2006
@@ -127,6 +127,6 @@
      */
     public String toString()
     {
-        return ldapResult.toString();
+        return ( ldapResult != null ? ldapResult.toString() : "" );
     }
 }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
Mon Nov 27 02:48:58 2006
@@ -610,8 +610,11 @@
 
                 LdapURL referral = ( LdapURL ) referrals.get( i );
 
-                sb.append( "                Referral[" ).append( i ).append( "] :" ).append(
referral == null ? "" : referral.toString() )
-                    .append( '\n' );
+                sb.append( "                Referral[" ).
+                    append( i ).
+                    append( "] :" ).
+                    append( referral == null ? "" : referral.toString() ).
+                    append( '\n' );
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
Mon Nov 27 02:48:58 2006
@@ -441,7 +441,7 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "    Add Request\n" );
-        sb.append( "        Entry : '" ).append( entry.toString() ).append( "'\n" );
+        sb.append( "        Entry : '" ).append( entry ).append( "'\n" );
         sb.append( "        Attributes\n" );
 
         if ( ( attributes == null ) || ( attributes.size() == 0 ) )

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequest.java
Mon Nov 27 02:48:58 2006
@@ -262,22 +262,22 @@
         sb.append( "    BindRequest\n" );
         sb.append( "        Version : '" ).append( version ).append( "'\n" );
 
-        if ( StringTools.isEmpty( name.toString() ) )
+        if ( (null == name) || StringTools.isEmpty( name.toString() ) )
         {
             sb.append( "        Name : anonymous\n" );
         }
         else
         {
-            sb.append( "        Name : '" ).append( name.toString() ).append( "'\n" );
+            sb.append( "        Name : '" ).append( name ).append( "'\n" );
 
             if ( authentication instanceof SimpleAuthentication )
             {
-                sb.append( "        Simple authentication : '" ).append(
-                    ( ( SimpleAuthentication ) authentication ).toString() ).append( "'\n"
);
+                sb.append( "        Simple authentication : '" ).
+                    append( authentication ).append( "'\n" );
             }
             else
             {
-                sb.append( ( ( SaslCredentials ) authentication ).toString() );
+                sb.append( authentication );
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindResponse.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindResponse.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindResponse.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindResponse.java
Mon Nov 27 02:48:58 2006
@@ -27,6 +27,7 @@
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -186,7 +187,9 @@
 
         if ( serverSaslCreds != null )
         {
-            sb.append( "        Server sasl credentials : '" ).append( serverSaslCreds.toString()
).append( "'\n" );
+            sb.append( "        Server sasl credentials : '" ).
+                append( StringTools.dumpBytes( serverSaslCreds ) ).
+                append( "'\n" );
         }
 
         return sb.toString();

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SaslCredentials.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SaslCredentials.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SaslCredentials.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SaslCredentials.java
Mon Nov 27 02:48:58 2006
@@ -208,11 +208,13 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "        Sasl credentials\n" );
-        sb.append( "            Mechanism :'" ).append( mechanism.toString() ).append( "'\n"
);
+        sb.append( "            Mechanism :'" ).append( mechanism ).append( "'\n" );
 
         if ( credentials != null )
         {
-            sb.append( "            Credentials :'" ).append( credentials.toString() ).append(
"'\n" );
+            sb.append( "            Credentials :'" ).
+                append( StringTools.dumpBytes(  credentials ) ).
+                append( "'\n" );
         }
 
         return sb.toString();

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequest.java
Mon Nov 27 02:48:58 2006
@@ -262,7 +262,6 @@
         return buffer;
     }
 
-
     /**
      * Get a String representation of a Compare Request
      * 
@@ -274,9 +273,9 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "    Compare request\n" );
-        sb.append( "        Entry : '" ).append( entry.toString() ).append( "'\n" );
-        sb.append( "        Attribute description : '" ).append( attributeDesc.toString()
).append( "'\n" );
-        sb.append( "        Attribute value : '" ).append( assertionValue.toString() ).append(
"'\n" );
+        sb.append( "        Entry : '" ).append( entry ).append( "'\n" );
+        sb.append( "        Attribute description : '" ).append( attributeDesc ).append(
"'\n" );
+        sb.append( "        Attribute value : '" ).append( StringTools.dumpObject( assertionValue
) ).append( "'\n" );
 
         return sb.toString();
     }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequest.java
Mon Nov 27 02:48:58 2006
@@ -157,7 +157,7 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "    Del request\n" );
-        sb.append( "        Entry : '" ).append( entry.toString() ).append( "'\n" );
+        sb.append( "        Entry : '" ).append( entry ).append( "'\n" );
 
         return sb.toString();
     }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequest.java
Mon Nov 27 02:48:58 2006
@@ -227,11 +227,13 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "    Extended request\n" );
-        sb.append( "        Request name : '" ).append( requestName.toString() ).append(
"'\n" );
+        sb.append( "        Request name : '" ).append( requestName ).append( "'\n" );
 
         if ( requestValue != null )
         {
-            sb.append( "        Request value : '" ).append( requestValue.toString() ).append(
"'\n" );
+            sb.append( "        Request value : '" ).
+                append( StringTools.dumpBytes( requestValue ) ).
+                append( "'\n" );
         }
 
         return sb.toString();

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
Mon Nov 27 02:48:58 2006
@@ -264,12 +264,12 @@
 
         if ( responseName != null )
         {
-            sb.append( "        Response name :'" ).append( responseName.toString() ).append(
"'\n" );
+            sb.append( "        Response name :'" ).append( responseName ).append( "'\n"
);
         }
 
         if ( response != null )
         {
-            sb.append( "        Response :'" ).append( response.toString() ).append( "'\n"
);
+            sb.append( "        Response :'" ).append( response ).append( "'\n" );
         }
 
         return sb.toString();

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
Mon Nov 27 02:48:58 2006
@@ -220,7 +220,7 @@
             while ( replicatedContextIterator.hasNext() )
             {
                 LdapURL url = ( LdapURL ) replicatedContextIterator.next();
-                sb.append( "\n        " ).append( url.toString() );
+                sb.append( "\n        " ).append( url );
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdown.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdown.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdown.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdown.java
Mon Nov 27 02:48:58 2006
@@ -113,7 +113,7 @@
     {
         StringBuffer sb = new StringBuffer();
 
-        sb.append( "Graceful Shiutdown extended operation" );
+        sb.append( "Graceful Shutdown extended operation" );
         sb.append( "    TimeOffline : " ).append( timeOffline ).append( '\n' );
         sb.append( "    Delay : " ).append( delay ).append( '\n' );
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
Mon Nov 27 02:48:58 2006
@@ -556,51 +556,69 @@
                 sb.append( "            Modification[" ).append( i ).append( "]\n" );
                 sb.append( "                Operation : " );
 
-                switch ( modification.getModificationOp() )
+                if ( modification != null )
                 {
-
-                    case DirContext.ADD_ATTRIBUTE:
-                        sb.append( " add\n" );
-                        break;
-
-                    case DirContext.REPLACE_ATTRIBUTE:
-                        sb.append( " replace\n" );
-                        break;
-
-                    case DirContext.REMOVE_ATTRIBUTE:
-                        sb.append( " delete\n" );
-                        break;
-                }
-
-                sb.append( "                Modification\n" );
-
-                Attribute attribute = modification.getAttribute();
-
-                try
-                {
-                    sb.append( "                    Type : '" ).append( attribute.getID()
).append( "'\n" );
-                    sb.append( "                    Vals\n" );
-
-                    for ( int j = 0; j < attribute.size(); j++ )
+                    switch ( modification.getModificationOp() )
                     {
+    
+                        case DirContext.ADD_ATTRIBUTE:
+                            sb.append( " add\n" );
+                            break;
+    
+                        case DirContext.REPLACE_ATTRIBUTE:
+                            sb.append( " replace\n" );
+                            break;
+    
+                        case DirContext.REMOVE_ATTRIBUTE:
+                            sb.append( " delete\n" );
+                            break;
+                    }
 
-                        Object attributeValue = attribute.get( j );
-                        sb.append( "                        Val[" ).append( j ).append( "]
: '" );
-
-                        if ( attributeValue instanceof String )
+                    sb.append( "                Modification\n" );
+    
+                    Attribute attribute = modification.getAttribute();
+    
+                    if ( attribute != null )
+                    {
+                        try
                         {
-                            sb.append( attributeValue ).append( "' \n" );
+                            sb.append( "                    Type : '" ).append( attribute.getID()
).append( "'\n" );
+                            sb.append( "                    Vals\n" );
+        
+                            for ( int j = 0; j < attribute.size(); j++ )
+                            {
+        
+                                Object attributeValue = attribute.get( j );
+                                sb.append( "                        Val[" ).append( j ).append(
"] : '" );
+        
+                                if ( attributeValue != null )
+                                {
+                                    if ( attributeValue instanceof String )
+                                    {
+                                        sb.append( attributeValue ).append( "' \n" );
+                                    }
+                                    else
+                                    {
+                                        sb.append( StringTools.utf8ToString( ( byte[] ) attributeValue
) ).append( "' \n" );
+                                    }
+                                }
+                                else
+                                {
+                                    sb.append( "<null>'\n" );
+                                }
+                            }
                         }
-                        else
+                        catch ( NamingException ne )
                         {
-                            sb.append( StringTools.utf8ToString( ( byte[] ) attributeValue
) ).append( "' \n" );
+                            log.error( "Naming exception while printing the '{}'", attribute.getID()
);
                         }
                     }
                 }
-                catch ( NamingException ne )
+                else
                 {
-                    log.error( "Naming exception while printing the '{}'", attribute.getID()
);
+                    sb.append( " unknown modification operation\n" );
                 }
+
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequest.java
Mon Nov 27 02:48:58 2006
@@ -289,12 +289,12 @@
 
         sb.append( "    ModifyDN Response\n" );
         sb.append( "        Entry : '" ).append( entry ).append( "'\n" );
-        sb.append( "        New RDN : '" ).append( newRDN.toString() ).append( "'\n" );
+        sb.append( "        New RDN : '" ).append( newRDN ).append( "'\n" );
         sb.append( "        Delete old RDN : " ).append( deleteOldRDN ).append( "\n" );
 
         if ( newSuperior != null )
         {
-            sb.append( "        New superior : '" ).append( newSuperior.toString() ).append(
"'\n" );
+            sb.append( "        New superior : '" ).append( newSuperior ).append( "'\n" );
         }
 
         return sb.toString();

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
Mon Nov 27 02:48:58 2006
@@ -235,6 +235,6 @@
      */
     public String toString()
     {
-        return assertion.toStringRFC2254( filterType );
+        return assertion != null ? assertion.toStringRFC2254( filterType ) : "";
     }
 }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
Mon Nov 27 02:48:58 2006
@@ -158,15 +158,13 @@
 
         if ( ( filterSet != null ) && ( filterSet.size() != 0 ) )
         {
-
             Iterator filterIterator = filterSet.iterator();
 
             while ( filterIterator.hasNext() )
             {
-
                 Filter filter = ( Filter ) filterIterator.next();
 
-                sb.append( '(' ).append( filter.toString() ).append( ')' );
+                sb.append( '(' ).append( filter ).append( ')' );
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java
Mon Nov 27 02:48:58 2006
@@ -344,7 +344,7 @@
 
         if ( type != null )
         {
-            sb.append( type.toString() );
+            sb.append( type );
         }
 
         if ( dnAttributes )
@@ -354,7 +354,6 @@
 
         if ( matchingRule == null )
         {
-
             if ( type == null )
             {
                 return "Extended Filter wrong syntax";
@@ -362,10 +361,10 @@
         }
         else
         {
-            sb.append( ':' ).append( matchingRule.toString() );
+            sb.append( ':' ).append( matchingRule );
         }
 
-        sb.append( ":=" ).append( matchValue.toString() );
+        sb.append( ":=" ).append( StringTools.dumpObject( matchValue ) );
 
         return sb.toString();
     }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
Mon Nov 27 02:48:58 2006
@@ -609,11 +609,7 @@
 
         StringBuffer sb = new StringBuffer();
 
-        sb.append( "(" );
-
-        sb.append( filter.toString() );
-
-        sb.append( ")" );
+        sb.append( "(" ).append( filter ).append( ")" );
 
         return sb.toString();
     }
@@ -626,23 +622,29 @@
     {
         StringBuffer sb = new StringBuffer();
 
-        NamingEnumeration attrs = attributes.getAll();
-        boolean isFirst = true;
-
-        while ( attrs.hasMoreElements() )
+        if ( attributes != null )
         {
-            Attribute attr = ( BasicAttribute ) attrs.nextElement();
-
-            if ( isFirst )
+            NamingEnumeration attrs = attributes.getAll();
+            boolean isFirst = true;
+    
+            if ( attrs != null )
             {
-                isFirst = false;
+                while ( attrs.hasMoreElements() )
+                {
+                    Attribute attr = ( BasicAttribute ) attrs.nextElement();
+        
+                    if ( isFirst )
+                    {
+                        isFirst = false;
+                    }
+                    else
+                    {
+                        sb.append( ", " );
+                    }
+        
+                    sb.append( attr != null ? attr.getID() : "<no ID>" );
+                }
             }
-            else
-            {
-                sb.append( ", " );
-            }
-
-            sb.append( attr.getID() );
         }
 
         return sb.toString();
@@ -733,6 +735,7 @@
         {
             sb.append( "        Attributes : " ).append( buildAttributes() ).append( "\n"
);
         }
+        
         return sb.toString();
     }
 }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
Mon Nov 27 02:48:58 2006
@@ -443,7 +443,7 @@
         StringBuffer sb = new StringBuffer();
 
         sb.append( "    Search Result Entry\n" );
-        sb.append( "        Object Name : '" ).append( objectName.toString() ).append( "'\n"
);
+        sb.append( "        Object Name : '" ).append( objectName ).append( "'\n" );
         sb.append( "        Attributes\n" );
 
         if ( ( partialAttributeList == null ) || ( partialAttributeList.size() == 0 ) )

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
Mon Nov 27 02:48:58 2006
@@ -206,8 +206,7 @@
 
             while ( referencesIterator.hasNext() )
             {
-                sb.append( "            '" ).append( ( ( LdapURL ) referencesIterator.next()
).toString() ).append(
-                    "'\n" );
+                sb.append( "            '" ).append( referencesIterator.next() ).append(
"'\n" );
             }
         }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
Mon Nov 27 02:48:58 2006
@@ -360,7 +360,7 @@
 
         if ( initialSubstrings != null )
         {
-            sb.append( initialSubstrings.toString() );
+            sb.append( initialSubstrings );
         }
 
         sb.append( '*' );
@@ -371,13 +371,13 @@
 
             while ( anyIterator.hasNext() )
             {
-                sb.append( ( String ) anyIterator.next() ).append( '*' );
+                sb.append( anyIterator.next() ).append( '*' );
             }
         }
 
         if ( finalSubstrings != null )
         {
-            sb.append( finalSubstrings.toString() );
+            sb.append( finalSubstrings );
         }
 
         return sb.toString();

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java
Mon Nov 27 02:48:58 2006
@@ -169,6 +169,7 @@
         sb.append( "    Entry Change Control\n" );
         sb.append( "        changeType   : '" ).append( changeType ).append( "'\n" );
         sb.append( "        previousDN   : '" ).append( previousDn ).append( "'\n" );
+        
         if ( changeNumber == UNDEFINED_CHANGE_NUMBER )
         {
             sb.append( "        changeNumber : '" ).append( "UNDEFINED" ).append( "'\n" );
@@ -177,6 +178,7 @@
         {
             sb.append( "        changeNumber : '" ).append( changeNumber ).append( "'\n"
);
         }
+        
         return sb.toString();
     }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Mon Nov 27 02:48:58 2006
@@ -347,48 +347,57 @@
 
         sb.append( tabs ).append( "Attributes\n" );
 
-        NamingEnumeration attributesIterator = attributes.getAll();
-
-        while ( attributesIterator.hasMoreElements() )
+        if ( attributes != null )
         {
-            Attribute attribute = ( Attribute ) attributesIterator.nextElement();
-
-            sb.append( tabs ).append( "    Type : '" ).append( attribute.getID() ).append(
"'\n" );
-
-            for ( int j = 0; j < attribute.size(); j++ )
+            NamingEnumeration attributesIterator = attributes.getAll();
+    
+            while ( attributesIterator.hasMoreElements() )
             {
-
-                try
+                Attribute attribute = ( Attribute ) attributesIterator.nextElement();
+    
+                if ( attribute != null )
                 {
-                    Object attr = attribute.get( j );
-
-                    if ( attr instanceof String )
+                    sb.append( tabs ).append( "    Type : '" ).append( attribute.getID()
).append( "'\n" );
+        
+                    for ( int j = 0; j < attribute.size(); j++ )
                     {
-                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "]
: " ).append( attr ).append(
-                            " \n" );
+        
+                        try
+                        {
+                            Object attr = attribute.get( j );
+        
+                            if ( attr != null )
+                            {
+                                if ( attr instanceof String )
+                                {
+                                    sb.append( tabs ).append( "        Val[" ).append( j
).append( "] : " ).append( attr ).append(
+                                        " \n" );
+                                }
+                                else if ( attr instanceof byte[] )
+                                {
+                                    String string = StringTools.utf8ToString( ( byte[] )
attr );
+            
+                                    sb.append( tabs ).append( "        Val[" ).append( j
).append( "] : " );
+                                    sb.append( string ).append( '/' );
+                                    sb.append( StringTools.dumpBytes( ( byte[] ) attr ) );
+                                    sb.append( " \n" );
+                                }
+                                else
+                                {
+                                    sb.append( tabs ).append( "        Val[" ).append( j
).append( "] : " ).append( attr ).append(
+                                        " \n" );
+                                }
+                            }
+                        }
+                        catch ( NamingException ne )
+                        {
+                            sb.append( "Bad attribute : " ).append( ne.getMessage() );
+                        }
                     }
-                    else if ( attr instanceof byte[] )
-                    {
-                        String string = StringTools.utf8ToString( ( byte[] ) attr );
-
-                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "]
: " );
-                        sb.append( string ).append( '/' );
-                        sb.append( StringTools.dumpBytes( ( byte[] ) attr ) );
-                        sb.append( " \n" );
-                    }
-                    else
-                    {
-                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "]
: " ).append( attr ).append(
-                            " \n" );
-                    }
-                }
-                catch ( NamingException ne )
-                {
-                    sb.append( "Bad attribute : " ).append( ne.getMessage() );
                 }
             }
         }
-
+        
         return sb.toString();
     }
 

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?view=diff&rev=479581&r1=479580&r2=479581
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
Mon Nov 27 02:48:58 2006
@@ -832,6 +832,35 @@
 
         return sb.toString();
     }
+    
+    /**
+     * 
+     * Helper method to render an object which can be a String or a byte[]
+     *
+     * @return A string representing the object
+     */
+    public static String dumpObject( Object object )
+    {
+        if ( object != null )
+        {
+            if ( object instanceof String )
+            {
+                return (String)object;
+            }
+            else if ( object instanceof byte[] )
+            {
+                return dumpBytes( (byte[])object );
+            }
+            else
+            {
+                return "<unknown type>";
+            }
+        }
+        else
+        {
+            return "";
+        }
+    }
 
     /**
      * Helper function that dump an array of bytes in hex pair form, 



Mime
View raw message