directory-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=683650&view=rev
Log:
fixing incorrect 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=683650&r1=683649&r2=683650&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:06:21 2008
@@ -1228,10 +1228,9 @@
         if ( dn != null )
         {
             sb.append( '/' ).append( urlEncode( dn.toString(), false ) );
-
-            if ( ( attributes.size() != 0 )
-                || ( ( scope != SearchControls.OBJECT_SCOPE ) || ( filter != null ) || 
-                    ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) ) )
+            sb.append( '?' );
+            
+            if ( attributes.size() != 0 )
             {
                 sb.append( '?' );
 
@@ -1252,92 +1251,87 @@
                 }
             }
 
-            if ( ( scope != SearchControls.OBJECT_SCOPE ) || ( filter != null ) || ( extensions.size()
!= 0 )
-                || ( criticalExtensions.size() != 0 ) )
+            sb.append( '?' );
+            
+            switch ( scope )
             {
-                sb.append( '?' );
-
-                switch ( scope )
-                {
 
-                    case SearchControls.OBJECT_SCOPE:
+                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;
+            }
 
-                        // This is the default value.
-                        break;
+            if ( ( filter != null ) || ( ( extensions.size() != 0 ) || ( criticalExtensions.size()
!= 0 ) ) )
+            {
+                sb.append( "?" );
 
-                    case SearchControls.ONELEVEL_SCOPE:
-                        sb.append( "one" );
-                        break;
-
-                    case SearchControls.SUBTREE_SCOPE:
-                        sb.append( "sub" );
-                        break;
-                        
-                        
-                    default :
-                        break;
+                if ( filter != null )
+                {
+                    sb.append( urlEncode( filter, false ) );
                 }
 
-                if ( ( filter != null ) || ( ( extensions.size() != 0 ) || ( criticalExtensions.size()
!= 0 ) ) )
+                if ( ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) )
                 {
-                    sb.append( "?" );
+                    sb.append( '?' );
 
-                    if ( filter != null )
-                    {
-                        sb.append( urlEncode( filter, false ) );
-                    }
+                    boolean isFirst = true;
 
-                    if ( ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 )
)
+                    if ( extensions.size() != 0 )
                     {
-                        sb.append( '?' );
-
-                        boolean isFirst = true;
-
-                        if ( extensions.size() != 0 )
+                        for ( String key:extensions.keySet() )
                         {
-                            for ( String key:extensions.keySet() )
-                            {
 
-                                if ( !isFirst )
-                                {
-                                    sb.append( ',' );
-                                }
-                                else
-                                {
-                                    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 )
+                    if ( criticalExtensions.size() != 0 )
+                    {
+                        for ( String key:criticalExtensions.keySet() )
                         {
-                            for ( String key:criticalExtensions.keySet() )
+
+                            if ( !isFirst )
+                            {
+                                sb.append( ",!" );
+                            }
+                            else
                             {
+                                sb.append( '!' );
+                                isFirst = false;
+                            }
 
-                                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 ) );
-                                }
+                            sb.append( urlEncode( key, false ) );
+                            
+                            String value = criticalExtensions.get( key );
+                            
+                            if ( value != null )
+                            {
+                                sb.append( '=' ).append(
+                                urlEncode( value, true ) );
                             }
                         }
                     }



Mime
View raw message