directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r757997 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/name/LdapDN.java test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Date Tue, 24 Mar 2009 20:14:50 GMT
Author: elecharny
Date: Tue Mar 24 20:14:49 2009
New Revision: 757997

URL: http://svn.apache.org/viewvc?rev=757997&view=rev
Log:
Fix for DIRSHARED-30

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=757997&r1=757996&r2=757997&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Tue Mar 24 20:14:49 2009
@@ -629,10 +629,11 @@
 
             // Ok, iterate through all the RDN of the name,
             // starting a the end of the current list.
+            int starting = size() - name.size();
 
             for ( int i = name.size() - 1; i >= 0; i-- )
             {
-                Rdn ldapRdn = rdns.get( rdns.size() - i - 1 );
+                Rdn ldapRdn = rdns.get( i + starting );
                 Rdn nameRdn = null;
 
                 try

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?rev=757997&r1=757996&r2=757997&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Tue Mar 24 20:14:49 2009
@@ -2067,6 +2067,15 @@
         assertTrue( !name0.startsWith( name6 ) );
         assertTrue( !name0.startsWith( name7 ) );
         assertTrue( !name0.startsWith( name8 ) );
+
+        assertTrue( "Starting DN fails with ADS LdapDN", 
+            new LdapDN( "ou=foo,dc=apache,dc=org" ).startsWith( new LdapDN( "dc=apache,dc=org"
) ) );
+        
+        assertTrue( "Starting DN fails with Java LdapName", 
+            new LdapDN( "ou=foo,dc=apache,dc=org" ).startsWith( new LdapName( "dc=apache,dc=org"
) ) );
+
+        assertTrue( "Starting DN fails with Java LdapName", 
+            new LdapDN( "dc=apache,dc=org" ).startsWith( new LdapName( "dc=apache,dc=org"
) ) );
     }
 
 



Mime
View raw message