directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r492889 - in /directory/branches/shared/0.9.5/ldap/src: main/java/org/apache/directory/shared/ldap/name/LdapDN.java test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Date Fri, 05 Jan 2007 03:21:19 GMT
Author: akarasulu
Date: Thu Jan  4 19:21:18 2007
New Revision: 492889

URL: http://svn.apache.org/viewvc?view=rev&rev=492889
Log:
bypass normalization on empty string dn and do not allow add("") to generate a malformed RDN

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

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?view=diff&rev=492889&r1=492888&r2=492889
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Thu Jan  4 19:21:18 2007
@@ -1024,6 +1024,11 @@
     */
    public Name add( String comp ) throws InvalidNameException
    {
+       if ( comp.length() == 0 )
+       {
+           return this;
+       }
+       
        // We have to parse the nameComponent which is given as an argument
        Rdn newRdn = new Rdn( comp );
 
@@ -1439,6 +1444,11 @@
    public void normalize( Map oidsMap ) throws InvalidNameException, NamingException
    {
        if ( ( oidsMap == null ) || ( oidsMap.size() == 0 ) )
+       {
+           return;
+       }
+
+       if ( size() == 0 ) 
        {
            return;
        }

Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?view=diff&rev=492889&r1=492888&r2=492889
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Thu Jan  4 19:21:18 2007
@@ -2677,11 +2677,20 @@
        System.out.println( dn.toString() );
    }
    
+   
    public void testDNEquals() throws NamingException
    {
        LdapDN dn1 = new LdapDN( "a=b,c=d,e=f" );
        LdapDN dn2 = new LdapDN( "a=b\\,c\\=d,e=f" );
        
        assertFalse( dn1.toString().equals( dn2.toString() ) );
+   }
+   
+   
+   public void testDNAddEmptyString() throws NamingException
+   {
+       LdapDN dn = new LdapDN();
+       assertTrue( dn.size() == 0 );
+       assertTrue( dn.add( "" ).size() == 0 );
    }
 }



Mime
View raw message