directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1071800 - in /directory/shared/branches/m1/ldap-model/src: main/java/org/apache/directory/shared/ldap/model/name/Dn.java test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
Date Thu, 17 Feb 2011 21:38:38 GMT
Author: elecharny
Date: Thu Feb 17 21:38:38 2011
New Revision: 1071800

URL: http://svn.apache.org/viewvc?rev=1071800&view=rev
Log:
o Removed the Dn( String )/Dn( SchemaManager, String ) constructors

Modified:
    directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
    directory/shared/branches/m1/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1071800&r1=1071799&r2=1071800&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Thu Feb 17 21:38:38 2011
@@ -179,24 +179,12 @@ public final class Dn implements Iterabl
 
 
     /**
-     * Creates a new DN from the given String
-     *
-     * @param upName The String that contains the Dn
-     * @throws LdapInvalidNameException if the String does not contain a valid Dn.
-     */
-    public Dn( String upName ) throws LdapInvalidDnException
-    {
-        this( null, upName );
-    }
-
-
-    /**
      * Creates a new Schema aware DN from the given String
      *
      * @param schemaManager the schema manager (optional)
      * @param upName The String that contains the Dn
      * @throws LdapInvalidNameException if the String does not contain a valid Dn.
-     */
+     *
     public Dn( SchemaManager schemaManager, String upName ) throws LdapInvalidDnException
     {
         if ( upName != null )
@@ -282,6 +270,11 @@ public final class Dn implements Iterabl
 
         for ( String upRdn : upRdns )
         {
+            if ( Strings.isEmpty( upRdn ) )
+            {
+                continue;
+            }
+            
             if ( isFirst )
             {
                 isFirst = false;
@@ -307,8 +300,8 @@ public final class Dn implements Iterabl
                 valueExpected = false;
             }
         }
-
-        if ( valueExpected )
+        
+        if ( !isFirst && valueExpected )
         {
             throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err(
I18n.ERR_04202 ) );
         }

Modified: directory/shared/branches/m1/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java?rev=1071800&r1=1071799&r2=1071800&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/DnParserTest.java
Thu Feb 17 21:38:38 2011
@@ -20,20 +20,19 @@
 package org.apache.directory.shared.ldap.model.name;
 
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
-import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.name.DnParser;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
 
 /**
@@ -45,11 +44,7 @@ import static org.junit.Assert.assertNot
 @Concurrency()
 public class DnParserTest
 {
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     // CONSTRUCTOR functions --------------------------------------------------
-
     /**
      * test an empty Dn
      */



Mime
View raw message