directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1085318 - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/ apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/core/src/main/java/org/apache/directory/s...
Date Fri, 25 Mar 2011 11:02:11 GMT
Author: elecharny
Date: Fri Mar 25 11:02:10 2011
New Revision: 1085318

URL: http://svn.apache.org/viewvc?rev=1085318&view=rev
Log:
o Renamed the addAll( Dn ) method to add( Dn )
o Fixed some potential NPE
o Minor other refactorings

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
    directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
Fri Mar 25 11:02:10 2011
@@ -133,7 +133,7 @@ public class SearchAuthorizationIT exten
         for ( int i = 0; ( i < children.length ) && ( count[0] < sizeLimit
); i++ )
         {
             Dn childRdn = new Dn();
-            childRdn = childRdn.addAll( parent );
+            childRdn = childRdn.add( parent );
             childRdn = childRdn.add( "ou=" + i );
             childRdns[i] = childRdn;
             children[i].setDn( childRdn );

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Fri Mar 25 11:02:10 2011
@@ -1614,7 +1614,7 @@ public abstract class ServerContext impl
         
         try
         {
-            return JndiUtils.toName( JndiUtils.fromName( prefix ).addAll( fqn ) );
+            return JndiUtils.toName( JndiUtils.fromName( prefix ).add( fqn ) );
         }
         catch ( LdapInvalidDnException lide )
         {
@@ -1711,7 +1711,7 @@ public abstract class ServerContext impl
         // Add to left hand side of cloned Dn the relative name arg
         try
         {
-            target = target.addAll( relativeName );
+            target = target.add( relativeName );
             target.applySchemaManager( schemaManager );
         }
         catch (LdapInvalidDnException lide )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
Fri Mar 25 11:02:10 2011
@@ -105,7 +105,7 @@ public class DefaultOperationManager imp
                 // So we have to take the Rdn one by one, and create a
                 // new Dn with the type and value UP form
     
-                Dn urlDn = ldapUrl.getDn().addAll( childDn );
+                Dn urlDn = ldapUrl.getDn().add( childDn );
     
                 ldapUrl.setDn( urlDn );
                 urls.add( ldapUrl.toString() );
@@ -155,7 +155,7 @@ public class DefaultOperationManager imp
                     // So we have to take the Rdn one by one, and create a
                     // new Dn with the type and value UP form
 
-                    Dn urlDn = ldapUrl.getDn().addAll( childDn );
+                    Dn urlDn = ldapUrl.getDn().add( childDn );
 
                     ldapUrl.setDn( urlDn );
                 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
Fri Mar 25 11:02:10 2011
@@ -873,7 +873,7 @@ public class SubentryInterceptor extends
              * ----------------------------------------------------------------
              */
             Dn baseDn = apDn;
-            baseDn = baseDn.addAll( subentry.getSubtreeSpecification().getBase() );
+            baseDn = baseDn.add( subentry.getSubtreeSpecification().getBase() );
 
             updateEntries( OperationEnum.ADD, addContext.getSession(), dn, apDn, subentry.getSubtreeSpecification(),
baseDn, operationalAttributes );
 
@@ -961,7 +961,7 @@ public class SubentryInterceptor extends
              */
             Dn apDn = dn.getParent();
             Dn baseDn = apDn;
-            baseDn = baseDn.addAll( removedSubentry.getSubtreeSpecification().getBase() );
+            baseDn = baseDn.add( removedSubentry.getSubtreeSpecification().getBase() );
 
             // Remove all the references to this removed subentry from all the selected entries
             updateEntries( OperationEnum.REMOVE, deleteContext.getSession(), dn, apDn, removedSubentry.getSubtreeSpecification(),
baseDn, null );
@@ -1057,7 +1057,7 @@ public class SubentryInterceptor extends
             // search for all entries selected by the old SS and remove references to subentry
             Dn apName = dn.getParent();
             Dn oldBaseDn = apName;
-            oldBaseDn = oldBaseDn.addAll( ssOld.getBase() );
+            oldBaseDn = oldBaseDn.add( ssOld.getBase() );
 
             ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
@@ -1094,7 +1094,7 @@ public class SubentryInterceptor extends
             subentry = subentryCache.getSubentry( dn );
             List<EntryAttribute> operationalAttributes = getSubentryOperationalAttributes(
dn, subentry );
             Dn newBaseDn = apName;
-            newBaseDn = newBaseDn.addAll( ssNew.getBase() );
+            newBaseDn = newBaseDn.add( ssNew.getBase() );
 
             searchOperationContext = new SearchOperationContext( modifyContext.getSession(),
newBaseDn, filter, controls );
             searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES
);
@@ -1189,7 +1189,7 @@ public class SubentryInterceptor extends
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
             Dn baseDn = apName;
-            baseDn = baseDn.addAll( ss.getBase() );
+            baseDn = baseDn.add( ss.getBase() );
             Dn newName = newSuperiorDn;
             newName = newName.add( oldDn.getRdn() );
             newName.applySchemaManager( schemaManager );
@@ -1280,7 +1280,7 @@ public class SubentryInterceptor extends
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
             Dn baseDn = apName;
-            baseDn = baseDn.addAll( ss.getBase() );
+            baseDn = baseDn.add( ss.getBase() );
             Dn newName = newSuperiorDn.getParent();
 
             newName = newName.add( moveAndRenameContext.getNewRdn() );
@@ -1363,7 +1363,7 @@ public class SubentryInterceptor extends
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
             Dn baseDn = apName;
-            baseDn = baseDn.addAll( ss.getBase() );
+            baseDn = baseDn.add( ss.getBase() );
             Dn newName = oldDn.getParent();
 
             newName = newName.add( renameContext.getNewRdn() );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
Fri Mar 25 11:02:10 2011
@@ -78,7 +78,7 @@ public class SubtreeEvaluator
         // First construct the subtree base, which is the concatenation of the
         // AP Dn and the subentry base
         Dn subentryBaseDn = apDn;
-        subentryBaseDn = subentryBaseDn.addAll( subtree.getBase() );
+        subentryBaseDn = subentryBaseDn.add( subtree.getBase() );
         
         String s = subentryBaseDn.toString();
         

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
Fri Mar 25 11:02:10 2011
@@ -1404,7 +1404,7 @@ public class SearchHandler extends LdapR
              * name past the farthest referral Dn which the target name extends.
              */
             Dn suffix = req.getBase().getDescendantOf( referralAncestor.getDn() );
-            Dn refDn = urlDn.addAll( suffix );
+            Dn refDn = urlDn.add( suffix );
             
             ldapUrl.setDn( refDn );
             ldapUrl.setForceScopeRendering( true );
@@ -1483,7 +1483,7 @@ public class SearchHandler extends LdapR
              * name past the farthest referral Dn which the target name extends.
              */
             Dn suffix = req.getBase().getDescendantOf( referralAncestor.getDn() );
-            urlDn = urlDn.addAll( suffix );
+            urlDn = urlDn.add( suffix );
 
             StringBuilder buf = new StringBuilder();
             buf.append( ldapUrl.getScheme() );

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
(original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
Fri Mar 25 11:02:10 2011
@@ -221,7 +221,7 @@ public class DnTest
         Dn target = new Dn();
 
         assertTrue( Dn.isValid( "cn=Kate Bush+sn=Bush,ou=system" ) );
-        target = target.addAll( dn );
+        target = target.add( dn );
         assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.toString() );
         assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.getName() );
     }
@@ -733,7 +733,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b" );
         Dn dn2 = new Dn( "c = d" );
-        dn = dn.addAll( dn2 );
+        dn = dn.add( dn2 );
         assertEquals( "c = d,a = b", dn.getName() );
     }
 
@@ -748,7 +748,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b" );
         Dn dn2 = new Dn();
-        dn = dn.addAll( dn2 );
+        dn = dn.add( dn2 );
         assertEquals( "a=b", dn.getNormName() );
         assertEquals( "a = b", dn.getName() );
     }
@@ -764,7 +764,7 @@ public class DnTest
     {
         Dn dn = new Dn();
         Dn dn2 = new Dn( "a = b" );
-        dn = dn.addAll( dn2 );
+        dn = dn.add( dn2 );
         assertEquals( "a = b", dn.getName() );
     }
 
@@ -779,7 +779,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b" );
         Dn dn2 = new Dn( "c = d" );
-        dn = dn2.addAll( dn );
+        dn = dn2.add( dn );
         assertEquals( "a = b,c = d", dn.getName() );
     }
 
@@ -794,7 +794,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b" );
         Dn dn2 = new Dn( "c = d" );
-        dn = dn.addAll( dn2 );
+        dn = dn.add( dn2 );
         assertEquals( "c = d,a = b", dn.getName() );
     }
 
@@ -809,7 +809,7 @@ public class DnTest
     {
         Dn dn = new Dn( "a = b" );
         Dn dn2 = new Dn();
-        dn = dn.addAll( dn2 );
+        dn = dn.add( dn2 );
         assertEquals( "a=b", dn.getNormName() );
         assertEquals( "a = b", dn.getName() );
     }
@@ -825,7 +825,7 @@ public class DnTest
     {
         Dn dn = new Dn();
         Dn dn2 = new Dn( "a = b" );
-        dn = dn.addAll( dn2 );
+        dn = dn.add( dn2 );
         assertEquals( "a = b", dn.getName() );
     }
 
@@ -1677,7 +1677,7 @@ public class DnTest
     {
         Dn name = new Dn();
         Dn name0 = new Dn( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        assertTrue( name0.equals( name.addAll( name0 ) ) );
+        assertTrue( name0.equals( name.add( name0 ) ) );
     }
 
 
@@ -1693,7 +1693,7 @@ public class DnTest
         Dn name1 = new Dn( "ou=Marketing,ou=East" );
         Dn name2 = new Dn( "cn=HomeDir,cn=John" );
         Dn nameAdded = new Dn( "cn=HomeDir,cn=John, ou=Marketing,ou=East" );
-        assertTrue( nameAdded.equals( name1.addAll( name2 ) ) );
+        assertTrue( nameAdded.equals( name1.add( name2 ) ) );
     }
 
 
@@ -1711,9 +1711,9 @@ public class DnTest
         Dn name1 = new Dn( "cn=HomeDir,cn=John" );
         Dn name2 = new Dn( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
-        name = name.addAll( name0 );
+        name = name.add( name0 );
         assertTrue( name0.equals( name ) );
-        assertTrue( name2.equals( name.addAll( name1 ) ) );
+        assertTrue( name2.equals( name.add( name1 ) ) );
     }
 
 
@@ -1731,9 +1731,9 @@ public class DnTest
         Dn name1 = new Dn( "cn=HomeDir,cn=John" );
         Dn name2 = new Dn( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
 
-        name = name.addAll( name0 );
+        name = name.add( name0 );
         assertTrue( name0.equals( name ) );
-        assertTrue( name2.equals( name.addAll( name1 ) ) );
+        assertTrue( name2.equals( name.add( name1 ) ) );
     }
 
 
@@ -2113,7 +2113,7 @@ public class DnTest
         Dn aName = new Dn( "cn=four,cn=three,cn=two,cn=one" );
 
         assertSame( jName, jName.addAll( new LdapName( "cn=seven,cn=six" ) ) );
-        assertNotSame( aName, aName.addAll( new Dn( "cn=seven,cn=six" ) ) );
+        assertNotSame( aName, aName.add( new Dn( "cn=seven,cn=six" ) ) );
         assertNotSame( jName.toString(), aName.toString() );
     }
 
@@ -2128,15 +2128,15 @@ public class DnTest
         Dn aName = new Dn( "cn=four,cn=three,cn=two,cn=one" );
 
         assertSame( jName, jName.addAll( 0, new LdapName( "cn=zero,cn=zero.5" ) ) );
-        assertNotSame( aName, aName.addAll( new Dn( "cn=zero,cn=zero.5" ) ) );
+        assertNotSame( aName, aName.add( new Dn( "cn=zero,cn=zero.5" ) ) );
         assertNotSame( jName.toString(), aName.toString() );
 
         assertSame( jName, jName.addAll( 2, new LdapName( "cn=zero,cn=zero.5" ) ) );
-        assertNotSame( aName, aName.addAll( new Dn( "cn=zero,cn=zero.5" ) ) );
+        assertNotSame( aName, aName.add( new Dn( "cn=zero,cn=zero.5" ) ) );
         assertNotSame( jName.toString(), aName.toString() );
 
         assertSame( jName, jName.addAll( jName.size(), new LdapName( "cn=zero,cn=zero.5"
) ) );
-        assertNotSame( aName, aName.addAll( new Dn( "cn=zero,cn=zero.5" ) ) );
+        assertNotSame( aName, aName.add( new Dn( "cn=zero,cn=zero.5" ) ) );
         assertNotSame( jName.toString(), aName.toString() );
     }
 
@@ -2918,7 +2918,7 @@ public class DnTest
 
         Dn anotherDn = new Dn( "ou=x,ou=users" );
 
-        dn = dn.addAll( anotherDn );
+        dn = dn.add( anotherDn );
         assertTrue( dn.isSchemaAware() );
 
         dn.applySchemaManager( schemaManager );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Fri Mar 25 11:02:10 2011
@@ -701,14 +701,12 @@ public class Dn implements Iterable<Rdn>
      */
     public Rdn getRdn()
     {
-        if ( rdns.size() == 0 )
-        {
-            return null;
-        }
-        else
+        if ( isNullOrEmpty( this ) )
         {
-            return rdns.get( 0 ).clone();
+            return Rdn.EMPTY_RDN;
         }
+        
+        return rdns.get( 0 ).clone();
     }
 
 
@@ -891,7 +889,7 @@ public class Dn implements Iterable<Rdn>
     /**
      * {@inheritDoc}
      */
-    public Dn addAll( Dn suffix ) throws LdapInvalidDnException
+    public Dn add( Dn suffix ) throws LdapInvalidDnException
     {
         if ( ( suffix == null ) || ( suffix.size() == 0 ) )
         {
@@ -979,14 +977,9 @@ public class Dn implements Iterable<Rdn>
      */
     public Dn getParent()
     {
-        if ( isEmpty() )
-        {
-            return null;
-        }
-
-        if ( rdns.size() == 0 )
+        if ( isNullOrEmpty( this ) )
         {
-            return EMPTY_DN;
+            return this;
         }
         
         int posn = rdns.size() - 1;
@@ -1299,12 +1292,7 @@ public class Dn implements Iterable<Rdn>
      */
     public static boolean isNullOrEmpty( Dn dn )
     {
-        if ( dn != null )
-        {
-            return dn.isEmpty();
-        }
-
-        return true;
+        return ( dn == null ) || dn.isEmpty();
     }
     
     

Modified: directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
(original)
+++ directory/studio/trunk/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
Fri Mar 25 11:02:10 2011
@@ -662,7 +662,7 @@ class SubtreeSpecificationDialog extends
             {
                 try
                 { 
-                    chopBase = chopBase.addAll( suffix );
+                    chopBase = chopBase.add( suffix );
                 }
                 catch ( LdapInvalidDnException lide )
                 {
@@ -703,7 +703,7 @@ class SubtreeSpecificationDialog extends
                 {
                     try
                     {
-                        chopBase = chopBase.addAll( suffix );
+                        chopBase = chopBase.add( suffix );
                     }
                     catch ( LdapInvalidDnException lide )
                     {

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java?rev=1085318&r1=1085317&r2=1085318&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
Fri Mar 25 11:02:10 2011
@@ -208,7 +208,7 @@ public class EntryWidget extends Browser
                         {
                             try
                             {         
-                                initialDn = initialDn.addAll( suffix );
+                                initialDn = initialDn.add( suffix );
                             }
                             catch ( LdapInvalidDnException lide )
                             {



Mime
View raw message