directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1344275 - in /directory/shared/trunk/ldap/model/src: main/antlr/distinguishedName.g test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
Date Wed, 30 May 2012 14:33:10 GMT
Author: elecharny
Date: Wed May 30 14:33:10 2012
New Revision: 1344275

URL: http://svn.apache.org/viewvc?rev=1344275&view=rev
Log:
Fix for DIRAPI-88 : we now correctly handle # in an attribute value

Modified:
    directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java

Modified: directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g?rev=1344275&r1=1344274&r2=1344275&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g (original)
+++ directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g Wed May 30 14:33:10
2012
@@ -678,6 +678,11 @@ sutf1 returns [String sutf1=""]
     | 
     space:SPACE  { sutf1 = space.getText(); }
     | 
+    // This is a hack to deal with #NN included into the value, due to 
+    // some collision with the HEXVALUE token. In this case, we should
+    // consider that a hex value is in fact a String
+    hex:HEXVALUE { sutf1 = "#" + hex.getText(); }
+    |
     numericoid:NUMERICOID  { sutf1 = numericoid.getText(); }    
     ;    
 

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java?rev=1344275&r1=1344274&r2=1344275&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
Wed May 30 14:33:10 2012
@@ -28,7 +28,6 @@ import static org.junit.Assert.fail;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.util.Strings;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -617,19 +616,12 @@ public class DnParserTest
      * Test case for DIRAPI-88 (RDN parsing fails with values containing a # character followed
by other characters)
      */
     @Test
-    @Ignore
     public final void testDIRAPI88()
     {
-        String dnString = "workforceID=200511230101#38SA";
-
-        try
-        {
-            Dn dn = new Dn( dnString );
-//            System.out.println( dn );
-        }
-        catch ( LdapInvalidDnException e )
-        {
-            fail( e.getMessage() );
-        }
+        assertTrue( Dn.isValid( "workforceID=2#28" ) );
+        assertTrue( Dn.isValid( "workforceID=2# + a=b" ) );
+        assertTrue( Dn.isValid( "workforceID=2#2Z" ) );
+        assertTrue( Dn.isValid( "workforceID=2#2" ) );
+        assertTrue( Dn.isValid( "workforceID=2#ZZ" ) );
     }
 }



Mime
View raw message