directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r707841 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
Date Sat, 25 Oct 2008 13:05:07 GMT
Author: elecharny
Date: Sat Oct 25 06:05:06 2008
New Revision: 707841

URL: http://svn.apache.org/viewvc?rev=707841&view=rev
Log:
Added a fix to the isLDIFSafe method : when the string to check was empty, we got a NPE.

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=707841&r1=707840&r2=707841&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
Sat Oct 25 06:05:06 2008
@@ -117,7 +117,7 @@
      */
     public static boolean isLDIFSafe( String str )
     {
-        if ( str == null )
+        if ( StringTools.isEmpty( str ) )
         {
             // A null string is LDIF safe
             return true;

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java?rev=707841&r1=707840&r2=707841&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
Sat Oct 25 06:05:06 2008
@@ -74,6 +74,26 @@
 
     
     /**
+     * Tests the method IsLdifSafe with a null String
+     */
+    @Test
+    public void testIsLdifNullString()
+    {
+        assertTrue( LdifUtils.isLDIFSafe( null ) );
+    }
+    
+
+    /**
+     * Tests the method IsLdifSafe with an empty String
+     */
+    @Test
+    public void testIsLdifEmptyString()
+    {
+        assertTrue( LdifUtils.isLDIFSafe( "" ) );
+    }
+    
+
+    /**
      * Tests the method IsLdifSafe with a String starting with the
      * char NUL (ASCII code 0)
      */
@@ -85,6 +105,7 @@
         assertFalse( LdifUtils.isLDIFSafe( c + testString ) );
     }
     
+
     /**
      * Tests the method IsLdifSafe with a String starting with the
      * char LF (ASCII code 10)



Mime
View raw message