directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r981236 - /directory/shared/branches/shared-dnfactory-experiment/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
Date Sun, 01 Aug 2010 14:57:02 GMT
Author: kayyagari
Date: Sun Aug  1 14:57:02 2010
New Revision: 981236

URL: http://svn.apache.org/viewvc?rev=981236&view=rev
Log:
o updated some constructors code to normalize DN
  (this seems to have a lot of side effects, and we might need to synchronized DN.normalize(oidMap)
method)

Modified:
    directory/shared/branches/shared-dnfactory-experiment/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java

Modified: directory/shared/branches/shared-dnfactory-experiment/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-dnfactory-experiment/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java?rev=981236&r1=981235&r2=981236&view=diff
==============================================================================
--- directory/shared/branches/shared-dnfactory-experiment/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
(original)
+++ directory/shared/branches/shared-dnfactory-experiment/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
Sun Aug  1 14:57:02 2010
@@ -152,7 +152,9 @@ public class DefaultEntry implements Ent
         }
 
         this.schemaManager = schemaManager;
-
+        
+        normalizeDN( dn );
+        
         // Initialize the ObjectClass object
         initObjectClassAT( schemaManager );
     }
@@ -206,19 +208,8 @@ public class DefaultEntry implements Ent
             dn = DN.EMPTY_DN;
         }
 
-        if ( !dn.isNormalized() )
-        {
-            try
-            {
-                // The dn must be normalized
-                dn.normalize( schemaManager.getNormalizerMapping() );
-            }
-            catch ( LdapException ne )
-            {
-                LOG.warn( "The DN '" + entry.getDn() + "' cannot be normalized" );
-            }
-        }
-
+        normalizeDN( dn );
+        
         // Init the attributes map
         attributes = new HashMap<String, EntryAttribute>( entry.size() );
 
@@ -275,7 +266,9 @@ public class DefaultEntry implements Ent
         }
 
         this.schemaManager = schemaManager;
-
+        
+        normalizeDN( dn );
+        
         initObjectClassAT( schemaManager );
 
         set( upIds );
@@ -334,6 +327,8 @@ public class DefaultEntry implements Ent
 
         this.schemaManager = schemaManager;
 
+        normalizeDN( dn );
+        
         initObjectClassAT( schemaManager );
 
         for ( EntryAttribute attribute : attributes )
@@ -381,6 +376,8 @@ public class DefaultEntry implements Ent
 
         this.schemaManager = schemaManager;
 
+        normalizeDN( dn );
+        
         // Initialize the ObjectClass object
         initObjectClassAT( schemaManager );
 
@@ -423,6 +420,8 @@ public class DefaultEntry implements Ent
 
         this.schemaManager = schemaManager;
 
+        normalizeDN( dn );
+        
         // Initialize the ObjectClass object
         initObjectClassAT( schemaManager );
 
@@ -2974,4 +2973,26 @@ public class DefaultEntry implements Ent
 
         return sb.toString();
     }
+    
+    
+    /**
+     * normalizes the given DN if it was not already normalized
+     * 
+     * @param dn the DN to be normalized
+     */
+    private void normalizeDN( DN dn )
+    {
+        if ( !dn.isNormalized() )
+        {
+            try
+            {
+                // The dn must be normalized
+                dn.normalize( schemaManager.getNormalizerMapping() );
+            }
+            catch ( LdapException ne )
+            {
+                LOG.warn( "The DN '{}' cannot be normalized", dn );
+            }
+        }
+    }
 }



Mime
View raw message