directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r745657 - /directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java
Date Wed, 18 Feb 2009 21:20:15 GMT
Author: seelmann
Date: Wed Feb 18 21:20:09 2009
New Revision: 745657

URL: http://svn.apache.org/viewvc?rev=745657&view=rev
Log:
DIRSTUDIO-463: Changed initialization of entries

Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java?rev=745657&r1=745656&r2=745657&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchRunnable.java
Wed Feb 18 21:20:09 2009
@@ -605,12 +605,25 @@
             parentDN = DnUtils.getParent( aDN );
             if ( parentDN == null )
             {
+                // only the root DSE has a null parent
                 entry = browserConnection.getRootDSE();
             }
-            else if ( browserConnection.getEntryFromCache( parentDN ) != null )
+            else if ( !parentDN.isEmpty() && browserConnection.getEntryFromCache(
parentDN ) != null )
             {
-                // check if the entry really exists
-                // if not a base dn entry will be created in then next iteration
+                // a normal entry has a parent but the parent isn't the rootDSE
+                IEntry parentEntry = browserConnection.getEntryFromCache( parentDN );
+                entry = new Entry( parentEntry, aDN.getRdn() );
+                entry.setDirectoryEntry( true );
+                parentEntry.addChild( entry );
+                parentEntry.setChildrenInitialized( true );
+                parentEntry.setHasMoreChildren( true );
+                parentEntry.setHasChildrenHint( true );
+                browserConnection.cacheEntry( entry );
+            }
+            else
+            {
+                // we have a base DN, check if the entry really exists in LDAP
+                // this is to avoid that a node "dc=com" is created for "dc=example,dc=com"
context entry
                 SearchParameter searchParameter = new SearchParameter();
                 searchParameter.setSearchBase( aDN );
                 searchParameter.setFilter( null );
@@ -627,18 +640,9 @@
                 {
                     if ( enumeration != null && enumeration.hasMore() )
                     {
-                        // entry exists, create entry and establish parent-child connection
-                        IEntry parentEntry = browserConnection.getEntryFromCache( parentDN
);
-                        entry = new Entry( parentEntry, aDN.getRdn() );
-                        entry.setDirectoryEntry( true );
-
-                        parentEntry.addChild( entry );
-                        // parentEntry.setAttributesInitialized(false, this);
-
-                        parentEntry.setChildrenInitialized( true );
-                        parentEntry.setHasMoreChildren( true );
-                        parentEntry.setHasChildrenHint( true );
-
+                        // create base DN entry
+                        entry = new BaseDNEntry( aDN, browserConnection );
+                        browserConnection.getRootDSE().addChild( entry );
                         browserConnection.cacheEntry( entry );
                     }
                 }
@@ -646,13 +650,6 @@
                 {
                 }
             }
-            else
-            {
-                // create base dn entry
-                entry = new BaseDNEntry( aDN, browserConnection );
-                browserConnection.getRootDSE().addChild( entry );
-                browserConnection.cacheEntry( entry );
-            }
         }
 
         return entry;



Mime
View raw message