directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r413443 - in /directory/branches/shared/optimization/ldap/src/main: antlr/ACIItem.g java/org/apache/directory/shared/ldap/aci/ACIItemParser.java java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Date Sun, 11 Jun 2006 13:23:43 GMT
Author: akarasulu
Date: Sun Jun 11 06:23:43 2006
New Revision: 413443

URL: http://svn.apache.org/viewvc?rev=413443&view=rev
Log:
checkpointing partial work on authz normalization fixes

Modified:
    directory/branches/shared/optimization/ldap/src/main/antlr/ACIItem.g
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java

Modified: directory/branches/shared/optimization/ldap/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/antlr/ACIItem.g?rev=413443&r1=413442&r2=413443&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/antlr/ACIItem.g (original)
+++ directory/branches/shared/optimization/ldap/src/main/antlr/ACIItem.g Sun Jun 11 06:23:43
2006
@@ -488,6 +488,7 @@
         // A Dn can be considered as a set of attributeTypeAndValues
         // So, parse the set as a Dn and extract each attributeTypeAndValue
         LdapDN attributeTypeAndValueSetAsDn = new LdapDN( token.getText() );
+        attributeTypeAndValueSetAsDn.normalize();
         Enumeration attributeTypeAndValueSet = attributeTypeAndValueSetAsDn.getAll();
         while ( attributeTypeAndValueSet.hasMoreElements() )
         {
@@ -1152,6 +1153,7 @@
     token:SAFEUTF8STRING
     {
         name = new LdapDN( token.getText() );
+        name.normalize();
         log.debug( "recognized a DistinguishedName: " + token.getText() );
     }
     ;

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java?rev=413443&r1=413442&r2=413443&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
Sun Jun 11 06:23:43 2006
@@ -98,7 +98,7 @@
      */
     public synchronized ACIItem parse( String spec ) throws ParseException
     {
-        ACIItem l_ACIItem = null;
+        ACIItem aCIItem = null;
 
         if ( spec == null || spec.trim().equals( "" ) )
         {
@@ -109,7 +109,7 @@
 
         try
         {
-            l_ACIItem = this.parser.wrapperEntryPoint();
+            aCIItem = this.parser.wrapperEntryPoint();
         }
         catch ( TokenStreamException e )
         {
@@ -124,7 +124,7 @@
             throw new ParseException( msg, e.getColumn() );
         }
 
-        return l_ACIItem;
+        return aCIItem;
     }
 
 

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=413443&r1=413442&r2=413443&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Sun Jun 11 06:23:43 2006
@@ -37,12 +37,18 @@
 {
     public static boolean containsValue( Attribute attr, Object compared, AttributeType type
) throws NamingException
     {
+        // quick bypass test
+        if ( attr.contains( compared ) )
+        {
+            return true;
+        }
+        
         Normalizer normalizer = type.getEquality().getNormalizer();
 
         if ( type.getSyntax().isHumanReadible() )
         {
             String comparedStr = ( String ) normalizer.normalize( compared );
-            for ( int ii = attr.size(); ii >= 0; ii-- )
+            for ( int ii = attr.size() - 1; ii >= 0; ii-- )
             {
                 String value = ( String ) attr.get( ii );
                 if ( comparedStr.equals( normalizer.normalize( value ) ) )
@@ -54,7 +60,7 @@
         else
         {
             byte[] comparedBytes = ( byte[] ) compared;
-            for ( int ii = attr.size(); ii >= 0; ii-- )
+            for ( int ii = attr.size() - 1; ii >= 0; ii-- )
             {
                 if ( ArrayUtils.isEquals( comparedBytes, attr.get( ii ) ) )
                 {
@@ -70,6 +76,15 @@
     public static boolean containsAnyValues( Attribute attr, Object[] compared, AttributeType
type )
         throws NamingException
     {
+        // quick bypass test
+        for ( int ii = 0; ii < compared.length; ii++ )
+        {
+            if ( attr.contains( compared ) )
+            {
+                return true;
+            }
+        }
+        
         Normalizer normalizer = type.getEquality().getNormalizer();
 
         if ( type.getSyntax().isHumanReadible() )



Mime
View raw message