directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1142716 - in /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model: name/Ava.java schema/PrepareString.java
Date Mon, 04 Jul 2011 15:31:16 GMT
Author: elecharny
Date: Mon Jul  4 15:31:15 2011
New Revision: 1142716

URL: http://svn.apache.org/viewvc?rev=1142716&view=rev
Log:
Fixed some errors in tests due to a double normalization

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/PrepareString.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java?rev=1142716&r1=1142715&r2=1142716&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
Mon Jul  4 15:31:15 2011
@@ -429,7 +429,6 @@ public class Ava implements Externalizab
         {
             this.normType = Strings.lowerCaseAscii( normTypeTrimmed );
             this.upType = upType;
-
         }
 
         this.normValue = normValue;
@@ -454,9 +453,11 @@ public class Ava implements Externalizab
         { 
             this.schemaManager = schemaManager;
             
+            AttributeType attributeType = null;
+            
             try
             {
-                attributeType = schemaManager.lookupAttributeTypeRegistry( upType );
+                attributeType = schemaManager.lookupAttributeTypeRegistry( normType );
             }
             catch ( LdapException le )
             {
@@ -465,7 +466,22 @@ public class Ava implements Externalizab
                 throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message,
le );
             }
             
+            if ( this.attributeType == attributeType ) 
+            {
+                // No need to normalize again
+                return;
+            }
+            else
+            {
+                this.attributeType = attributeType;
+            }
+            
             normType = attributeType.getOid();
+            
+            if ( normValue != null )
+            {
+                return;
+            }
 
             try
             {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/PrepareString.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/PrepareString.java?rev=1142716&r1=1142715&r2=1142716&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/PrepareString.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/PrepareString.java
Mon Jul  4 15:31:15 2011
@@ -22,8 +22,8 @@ package org.apache.directory.shared.ldap
 
 import java.io.IOException;
 
-import org.apache.directory.shared.util.exception.InvalidCharacterException;
 import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.exception.InvalidCharacterException;
 
 /**
  * 
@@ -252,7 +252,7 @@ public final class PrepareString
             case 0x0058 : 
             case 0x0059 : 
             case 0x005A : 
-                target[pos++] = (char)( c | lowerCase );
+                target[pos++] = (char)(c | lowerCase);
                 break;
     
             case 0x007F:
@@ -4698,13 +4698,13 @@ public final class PrepareString
 
     /**
      * 
-     * Remove all insignifiant spaces in a string.
+     * Remove all insignificant spaces in a string.
      * 
      * This method use a finite state machine to parse
      * the text.
      * 
      * @param str The String to modify
-     * @param caseSensitive A flag telling if the chars must be lowercased
+     * @param caseSensitive A flag telling if the chars must be lower cased
      * @return The modified StringBuilder
      * @throws InvalidCharacterException If an invalid character is found in the String
      */



Mime
View raw message