directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r620282 - in /directory/shared/branches/0.9.8/ldap/src: main/java/org/apache/directory/shared/ldap/name/RdnParser.java test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Date Sun, 10 Feb 2008 13:15:13 GMT
Author: seelmann
Date: Sun Feb 10 05:15:11 2008
New Revision: 620282

URL: http://svn.apache.org/viewvc?rev=620282&view=rev
Log:
Fix for DIRSTUDIO-161. RDN with empty value is valid, e.g. 'dc='

Modified:
    directory/shared/branches/0.9.8/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
    directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
    directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java

Modified: directory/shared/branches/0.9.8/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/0.9.8/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java?rev=620282&r1=620281&r2=620282&view=diff
==============================================================================
--- directory/shared/branches/0.9.8/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
(original)
+++ directory/shared/branches/0.9.8/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
Sun Feb 10 05:15:11 2008
@@ -595,7 +595,7 @@
         if( bytes.length <= pos.start )
         {
             // no attribute value
-            return false;
+            return true;
         }
 
         byte c = bytes[pos.start];

Modified: directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?rev=620282&r1=620281&r2=620282&view=diff
==============================================================================
--- directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Sun Feb 10 05:15:11 2008
@@ -2831,8 +2831,8 @@
         assertFalse( LdapDN.isValid( "a" ) );
         assertFalse( LdapDN.isValid( "a " ) );
 
-        assertFalse( LdapDN.isValid( "a=" ) );
-        assertFalse( LdapDN.isValid( "a= " ) );
+        assertTrue( LdapDN.isValid( "a=" ) );
+        assertTrue( LdapDN.isValid( "a= " ) );
 
         assertFalse( LdapDN.isValid( "=" ) );
         assertFalse( LdapDN.isValid( " = " ) );

Modified: directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?rev=620282&r1=620281&r2=620282&view=diff
==============================================================================
--- directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
(original)
+++ directory/shared/branches/0.9.8/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Sun Feb 10 05:15:11 2008
@@ -612,4 +612,17 @@
         assertEquals( "\\#a#b", Rdn.escapeValue( "#a#b" ) );
         assertEquals( "\\##a#b", Rdn.escapeValue( "##a#b" ) );
     }
+
+
+    /**
+     * test an RDN with empty value
+     */
+    public void testRdnWithEmptyValue() throws InvalidNameException
+    {
+        assertTrue( RdnParser.isValid( "a=" ) );
+        assertTrue( RdnParser.isValid( "a=\"\"" ) );
+        assertEquals( "a=", new Rdn( "a=\"\"" ).toString() );
+        assertEquals( "a=", new Rdn( "a=" ).toString() );
+    }
+
 }



Mime
View raw message