You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/12/02 08:20:27 UTC
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
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.