directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r370294 - /directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/event/SubstringEvaluator.java
Date Wed, 18 Jan 2006 22:46:05 GMT
Author: elecharny
Date: Wed Jan 18 14:46:02 2006
New Revision: 370294

URL: http://svn.apache.org/viewcvs?rev=370294&view=rev
Log:
- Get rid of a.o.regexp and oro, replaced them by jdk 1.4 regexp

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/event/SubstringEvaluator.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/event/SubstringEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/event/SubstringEvaluator.java?rev=370294&r1=370293&r2=370294&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/event/SubstringEvaluator.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/event/SubstringEvaluator.java
Wed Jan 18 14:46:02 2006
@@ -17,6 +17,9 @@
 package org.apache.ldap.server.event;
 
 
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -28,8 +31,6 @@
 import org.apache.ldap.common.schema.Normalizer;
 import org.apache.ldap.server.schema.AttributeTypeRegistry;
 import org.apache.ldap.server.schema.OidRegistry;
-import org.apache.regexp.RE;
-import org.apache.regexp.RESyntaxException;
 
 
 /**
@@ -66,7 +67,7 @@
     public boolean evaluate( ExprNode node, String dn, Attributes entry )
         throws NamingException
     {
-        RE regex = null; 
+        Pattern regex = null; 
         SubstringNode snode = ( SubstringNode ) node;
         String oid = oidRegistry.getOid( snode.getAttribute() );
         AttributeType type = attributeTypeRegistry.lookup( oid );
@@ -86,11 +87,11 @@
         {
             regex = snode.getRegex( normalizer );
         } 
-        catch ( RESyntaxException e ) 
+        catch ( PatternSyntaxException pse ) 
         {
             NamingException ne = new NamingException( "SubstringNode '" 
                 + node + "' had " + "incorrect syntax" );
-            ne.setRootCause( e );
+            ne.setRootCause( pse );
             throw ne;
         }
         
@@ -100,14 +101,16 @@
          * The test uses the comparator obtained from the appropriate 
          * substring matching rule.
          */ 
-        NamingEnumeration list = attr.getAll(); 
+        NamingEnumeration list = attr.getAll();
+        
         while ( list.hasMore() ) 
         {
             String value = ( String ) 
                 normalizer.normalize( list.next() );
             
             // Once match is found cleanup and return true
-            if ( regex.match( value ) ) 
+            
+            if ( regex.matcher( value ).matches() ) 
             {
                 list.close();
                 return true;



Mime
View raw message