commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r1058365 - in /commons/proper/lang/branches/LANG_2_X/src: main/java/org/apache/commons/lang/StringUtils.java test/java/org/apache/commons/lang/StringUtilsTest.java
Date Thu, 13 Jan 2011 00:04:50 GMT
Author: niallp
Date: Thu Jan 13 00:04:49 2011
New Revision: 1058365

URL: http://svn.apache.org/viewvc?rev=1058365&view=rev
Log:
Use strip() instead of trim() - trim() doesn't remove all whitespace characters

Modified:
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
    commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/StringUtilsTest.java

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java?rev=1058365&r1=1058364&r2=1058365&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/StringUtils.java
Thu Jan 13 00:04:49 2011
@@ -6542,7 +6542,7 @@ public class StringUtils {
      * @since 2.6
      */
     public static String normalizeSpace(String str) {
-        str = trim(str);
+        str = strip(str);
         if(str == null || str.length() <= 2) {
             return str;
         }

Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/StringUtilsTest.java?rev=1058365&r1=1058364&r2=1058365&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/StringUtilsTest.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/StringUtilsTest.java
Thu Jan 13 00:04:49 2011
@@ -1938,6 +1938,9 @@ public class StringUtilsTest extends Tes
         assertEquals("a", StringUtils.normalizeSpace("  a  "));
         assertEquals("a b c", StringUtils.normalizeSpace("  a  b   c  "));
         assertEquals("a b c", StringUtils.normalizeSpace("a\t\f\r  b\u000B   c\n"));
+        assertEquals("", StringUtils.normalizeSpace(WHITESPACE));
+        assertEquals("A", StringUtils.normalizeSpace(WHITESPACE + " A " + WHITESPACE));
+        assertEquals("A B", StringUtils.normalizeSpace(WHITESPACE + " A " + WHITESPACE +
" B " + WHITESPACE));
     }
 
     public void testLANG666() {



Mime
View raw message