directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r345931 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/StringTools.java
Date Mon, 21 Nov 2005 16:41:37 GMT
Author: elecharny
Date: Mon Nov 21 08:41:33 2005
New Revision: 345931

URL: http://svn.apache.org/viewcvs?rev=345931&view=rev
Log:
- Check that the string to be trimmed is not null or empty. In these
cases, an empty string is returned.

Modified:
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/StringTools.java

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/StringTools.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/StringTools.java?rev=345931&r1=345930&r2=345931&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/StringTools.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/StringTools.java
Mon Nov 21 08:41:33 2005
@@ -45,6 +45,11 @@
      */
     public static String trimConsecutiveToOne( String str, char ch )
     {
+        if ( ( null == str ) || ( str.length() == 0 ) )
+        {
+            return "";
+        }
+
         char[] buffer = str.toCharArray();
         char[] newbuf = new char[buffer.length];
         int pos = 0;
@@ -117,9 +122,9 @@
      */
     public static String deepTrim( String str, boolean toLowerCase )
     {
-        if ( null == str )
+        if ( ( null == str ) || ( str.length() == 0 ) )
         {
-            return null ;
+            return "";
         }
 
         char ch ;



Mime
View raw message