directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r109463 - /incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g /incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
Date Thu, 02 Dec 2004 07:20:27 GMT
Author: akarasulu
Date: Wed Dec  1 23:20:26 2004
New Revision: 109463

URL: http://svn.apache.org/viewcvs?view=rev&rev=109463
Log:
Changes ...

 o captured failed situation from JIRA issue in test case where we had the
   following substring pattern *any*
 o made changes to parser grammar to recognize situations where the initial
   and final values are null; so this would work with *any* or *any*any* etc

Notes ...

 This was a fix to the following JIRA issue filed by Enrique Rodriguez:

         http://nagoya.apache.org/jira/browse/DIRLDAP-21



Modified:
   incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g
   incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java

Modified: incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g
Url: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g?view=diff&rev=109463&p1=incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g&r1=109462&p2=incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g&r2=109463
==============================================================================
--- incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g	(original)
+++ incubator/directory/ldap/trunk/common/src/antlr/filter-value-parser.g	Wed Dec  1 23:20:26
2004
@@ -194,7 +194,15 @@
 
             fin = alt2.getText().trim();
         }
-        )+
+        )+ ( ASTERISK 
+        {
+            if ( fin != null && fin.length() > 0 )
+            {
+                any.add( fin );
+            }
+
+            fin = null;
+        })?
     |
         // A L T E R N A T I V E   3:    initial (*any) *final
         alt3t0:VALUEENCODING

Modified: incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
Url: http://svn.apache.org/viewcvs/incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java?view=diff&rev=109463&p1=incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java&r1=109462&p2=incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java&r2=109463
==============================================================================
--- incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
(original)
+++ incubator/directory/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
Wed Dec  1 23:20:26 2004
@@ -556,6 +556,24 @@
     }
 
 
+    /**
+     * Enrique just found this bug with the filter parser when parsing substring
+     * expressions like *any*.  Here's the JIRA issue:
+     * <a href="http://nagoya.apache.org/jira/browse/DIRLDAP-21">DIRLDAP-21</a>.
+     */
+    public void testSubstringStarAnyStar() throws IOException, ParseException
+    {
+        SubstringNode node = ( SubstringNode ) parser.parse( "( ou =*foo*)" );
+        assertEquals( "ou", node.getAttribute() );
+        assertEquals( AbstractExprNode.SUBSTRING, node.getAssertionType() );
+
+        assertEquals( 1, node.getAny().size() );
+        assertTrue( node.getAny().contains( "foo" ) );
+        assertNull( node.getInitial() );
+        assertNull( node.getFinal() );
+    }
+
+
     /* @todo look at custom error handlers for the parser */
     /////// Causes parser to hang rather than really bombing out.  Looks like
     /////// we may need to implement a custom error handler for this parser.

Mime
View raw message