directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r488456 - in /directory/trunks/shared/ldap/src: main/antlr/schema-qdstring.g test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
Date Mon, 18 Dec 2006 23:42:53 GMT
Author: akarasulu
Date: Mon Dec 18 15:42:52 2006
New Revision: 488456

URL: http://svn.apache.org/viewvc?view=rev&rev=488456
Log:
committing patch from seelmann for JIRA issue DIRSERVER-793

Modified:
    directory/trunks/shared/ldap/src/main/antlr/schema-qdstring.g
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java

Modified: directory/trunks/shared/ldap/src/main/antlr/schema-qdstring.g
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/antlr/schema-qdstring.g?view=diff&rev=488456&r1=488455&r2=488456
==============================================================================
--- directory/trunks/shared/ldap/src/main/antlr/schema-qdstring.g (original)
+++ directory/trunks/shared/ldap/src/main/antlr/schema-qdstring.g Mon Dec 18 15:42:52 2006
@@ -120,6 +120,9 @@
     		if(qdstring.endsWith("'")) {
     			qdstring = qdstring.substring(0, qdstring.length()-1);
     		}
+    		qdstring = qdstring.replaceAll("\\\\5C", "\\\\");
+    		qdstring = qdstring.replaceAll("\\\\5c", "\\\\");
+    		qdstring = qdstring.replaceAll("\\\\27", "'");
         } 
     )
     ; 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java?view=diff&rev=488456&r1=488455&r2=488456
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
(original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
Mon Dec 18 15:42:52 2006
@@ -322,7 +322,21 @@
         value = "( "+oid+" "+required+" DESC 'Descripton äöüß 部長' )";
         asd = parser.parse( value );
         assertEquals( "Descripton äöüß 部長", asd.getDescription() );
-
+        
+        // escaped characters
+        value = "( "+oid+" "+required+" DESC 'test\\5Ctest' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "test\\test", asd.getDescription() );
+        value = "( "+oid+" "+required+" DESC 'test\\5ctest' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "test\\test", asd.getDescription() );
+        value = "( "+oid+" "+required+" DESC 'test\\27test' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "test'test", asd.getDescription() );
+        value = "( "+oid+" "+required+" DESC '\\5C\\27\\5c' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "\\'\\", asd.getDescription() );
+        
         // lowercase
         value = "( "+oid+" "+required+" desc 'Descripton' )";
         try
@@ -384,6 +398,14 @@
         assertEquals( "test2-1", asd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
         assertEquals( "test2-2", asd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
 
+        // some more complicated
+        value = "("+oid+" "+required+" X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
('\\5C\\27\\5c'))";
+        asd = parser.parse( value );
+        assertEquals( 1, asd.getExtensions().size() );
+        assertNotNull( asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
) );
+        assertEquals( 1, asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
).size() );
+        assertEquals( "\\'\\", asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
).get( 0 ) );
+        
         // invalid extension, no number allowed
         value = "( "+oid+" "+required+" X-TEST1 'test' )";
         try



Mime
View raw message