directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r683653 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java
Date Thu, 07 Aug 2008 17:15:19 GMT
Author: akarasulu
Date: Thu Aug  7 10:15:18 2008
New Revision: 683653

URL: http://svn.apache.org/viewvc?rev=683653&view=rev
Log:
reverting incorrect changes to toString() method

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java?rev=683653&r1=683652&r2=683653&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java
Thu Aug  7 10:15:18 2008
@@ -1228,9 +1228,10 @@
         if ( dn != null )
         {
             sb.append( '/' ).append( urlEncode( dn.toString(), false ) );
-            sb.append( '?' );
-            
-            if ( attributes.size() != 0 )
+
+            if ( ( attributes.size() != 0 )
+                || ( ( scope != SearchControls.OBJECT_SCOPE ) || ( filter != null ) || 
+                    ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) ) )
             {
                 sb.append( '?' );
 
@@ -1251,87 +1252,92 @@
                 }
             }
 
-            sb.append( '?' );
-            
-            switch ( scope )
+            if ( ( scope != SearchControls.OBJECT_SCOPE ) || ( filter != null ) || ( extensions.size()
!= 0 )
+                || ( criticalExtensions.size() != 0 ) )
             {
+                sb.append( '?' );
 
-                case SearchControls.OBJECT_SCOPE:
-                    sb.append( "base" );
-                    break;
-
-                case SearchControls.ONELEVEL_SCOPE:
-                    sb.append( "one" );
-                    break;
-
-                case SearchControls.SUBTREE_SCOPE:
-                    sb.append( "sub" );
-                    break;
-                    
-                    
-                default :
-                    break;
-            }
+                switch ( scope )
+                {
 
-            if ( ( filter != null ) || ( ( extensions.size() != 0 ) || ( criticalExtensions.size()
!= 0 ) ) )
-            {
-                sb.append( "?" );
+                    case SearchControls.OBJECT_SCOPE:
 
-                if ( filter != null )
-                {
-                    sb.append( urlEncode( filter, false ) );
+                        // This is the default value.
+                        break;
+
+                    case SearchControls.ONELEVEL_SCOPE:
+                        sb.append( "one" );
+                        break;
+
+                    case SearchControls.SUBTREE_SCOPE:
+                        sb.append( "sub" );
+                        break;
+                        
+                        
+                    default :
+                        break;
                 }
 
-                if ( ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) )
+                if ( ( filter != null ) || ( ( extensions.size() != 0 ) || ( criticalExtensions.size()
!= 0 ) ) )
                 {
-                    sb.append( '?' );
+                    sb.append( "?" );
 
-                    boolean isFirst = true;
+                    if ( filter != null )
+                    {
+                        sb.append( urlEncode( filter, false ) );
+                    }
 
-                    if ( extensions.size() != 0 )
+                    if ( ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 )
)
                     {
-                        for ( String key:extensions.keySet() )
-                        {
+                        sb.append( '?' );
 
-                            if ( !isFirst )
-                            {
-                                sb.append( ',' );
-                            }
-                            else
+                        boolean isFirst = true;
+
+                        if ( extensions.size() != 0 )
+                        {
+                            for ( String key:extensions.keySet() )
                             {
-                                isFirst = false;
-                            }
 
-                            sb.append( urlEncode( key, false ) ).append( '=' ).append(
-                                urlEncode( extensions.get( key ), true ) );
+                                if ( !isFirst )
+                                {
+                                    sb.append( ',' );
+                                }
+                                else
+                                {
+                                    isFirst = false;
+                                }
+
+                                sb.append( urlEncode( key, false ) ).append( '=' ).append(
+                                    urlEncode( extensions.get( key ), true ) );
+                            }
                         }
-                    }
 
-                    isFirst = true;
+                        isFirst = true;
 
-                    if ( criticalExtensions.size() != 0 )
-                    {
-                        for ( String key:criticalExtensions.keySet() )
+                        if ( criticalExtensions.size() != 0 )
                         {
-
-                            if ( !isFirst )
-                            {
-                                sb.append( ",!" );
-                            }
-                            else
+                            for ( String key:criticalExtensions.keySet() )
                             {
-                                sb.append( '!' );
-                                isFirst = false;
-                            }
 
-                            sb.append( urlEncode( key, false ) );
-                            
-                            String value = criticalExtensions.get( key );
-                            
-                            if ( value != null )
-                            {
-                                sb.append( '=' ).append(
-                                urlEncode( value, true ) );
+                                if ( !isFirst )
+                                {
+                                    sb.append( ",!" );
+                                }
+                                else
+                                {
+                                    sb.append( '!' );
+                                    isFirst = false;
+                                }
+
+                                sb.append( urlEncode( key, false ) );
+                                
+                                String value = criticalExtensions.get( key );
+                                
+                                if ( value != null )
+                                {
+                                    sb.append( '=' ).append(
+                                    urlEncode( value, true ) );
+                                }
                             }
                         }
                     }



Mime
View raw message