directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r981910 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
Date Tue, 03 Aug 2010 15:02:15 GMT
Author: kayyagari
Date: Tue Aug  3 15:02:15 2010
New Revision: 981910

URL: http://svn.apache.org/viewvc?rev=981910&view=rev
Log:
o updated the all the constructors to normalize the DN

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java?rev=981910&r1=981909&r2=981910&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java
Tue Aug  3 15:02:15 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