directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1603714 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
Date Thu, 19 Jun 2014 05:43:30 GMT
Author: kayyagari
Date: Thu Jun 19 05:43:30 2014
New Revision: 1603714

URL: http://svn.apache.org/r1603714
Log:
added a flag to turn DN validation on/off

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java?rev=1603714&r1=1603713&r2=1603714&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
Thu Jun 19 05:43:30 2014
@@ -236,6 +236,9 @@ public class LdifReader implements Itera
     /** the numer of the current line being parsed by the reader */
     protected int lineNumber;
 
+    /** flag to turn on/off of the DN validation. By default DNs are validated after parsing
*/
+    protected boolean validateDn = true;
+    
     /**
      * Constructors
      */
@@ -554,7 +557,7 @@ public class LdifReader implements Itera
         }
 
         // Check that the Dn is valid. If not, an exception will be thrown
-        if ( !Dn.isValid( dn ) )
+        if ( validateDn && !Dn.isValid( dn ) )
         {
             String message = I18n.err( I18n.ERR_12017_INVALID_DN, dn );
             LOG.error( message );
@@ -1985,7 +1988,26 @@ public class LdifReader implements Itera
         return new LdifEntry();
     }
     
-    
+    /**
+     * @return true if the DN validation is turned on
+     */
+    public boolean isValidateDn()
+    {
+        return validateDn;
+    }
+
+
+    /**
+     * Turns on/off the DN validation
+     * 
+     * @param validateDn the boolean flag
+     */
+    public void setValidateDn( boolean validateDn )
+    {
+        this.validateDn = validateDn;
+    }
+
+
     /**
      * {@inheritDoc}
      */



Mime
View raw message