directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1553636 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
Date Fri, 27 Dec 2013 07:24:02 GMT
Author: kayyagari
Date: Fri Dec 27 07:24:02 2013
New Revision: 1553636

URL: http://svn.apache.org/r1553636
Log:
changed the comparator to sort hierarchically 

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java?rev=1553636&r1=1553635&r2=1553636&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
Fri Dec 27 07:24:02 2013
@@ -67,6 +67,21 @@ public class DnComparator extends LdapCo
             return -1;
         }
 
+        // check the equality first, cause
+        // when both DNs are equal checking isAncestorOf() returns true
+        if ( dn0.equals( dn1 ) )
+        {
+            return 0;
+        }
+        else if( dn0.isAncestorOf( dn1 ) )
+        {
+            return 1;
+        }
+        else if( dn1.isAncestorOf( dn0 ) )
+        {
+            return -1;
+        }
+
         return dn0.getNormName().compareTo( dn1.getNormName() );
     }
 



Mime
View raw message