You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pa...@apache.org on 2016/07/31 17:58:28 UTC
[lang] LANG-1226: StringUtils#normalizeSpace does not trim the string
anymore (closes #150)
Repository: commons-lang
Updated Branches:
refs/heads/master ed14537b8 -> 7e85d1cf5
LANG-1226: StringUtils#normalizeSpace does not trim the string anymore (closes #150)
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/7e85d1cf
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/7e85d1cf
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/7e85d1cf
Branch: refs/heads/master
Commit: 7e85d1cf54b1e467607a0019b56f91577ebe2e4f
Parents: ed14537
Author: pascalschumacher <pa...@gmx.net>
Authored: Sat May 21 18:13:03 2016 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sun Jul 31 19:57:50 2016 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 +-
src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7e85d1cf/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 41b14ff..224e034 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="3.5" date="tba" description="tba">
+ <action issue="LANG-1226" type="fix" dev="pschumacher" due-to="pschumacher">StringUtils#normalizeSpace does not trim the string anymore</action>
<action issue="LANG-1251" type="fix" dev="pschumacher" due-to="Takuya Ueshin">SerializationUtils.ClassLoaderAwareObjectInputStream should use static initializer to initialize primitiveTypes map</action>
<action issue="LANG-1253" type="add" dev="ggregory" due-to="adilek">[GitHub issue #170] Add RandomUtils#nextBoolean() method</action>
<action issue="LANG-1247" type="update" dev="chas" due-to="Benoit Wiart">FastDatePrinter generates extra Date objects</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7e85d1cf/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 9bc6396..0ef2ff1 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -8220,7 +8220,7 @@ public class StringUtils {
if (startWhitespaces) {
return EMPTY;
}
- return new String(newChars, 0, count - (whitespacesCount > 0 ? 1 : 0));
+ return new String(newChars, 0, count - (whitespacesCount > 0 ? 1 : 0)).trim();
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/7e85d1cf/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index a5c7bbb..bd1b07d 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -2614,6 +2614,8 @@ public class StringUtilsTest {
assertEquals("a b c", StringUtils.normalizeSpace(" a b c "));
assertEquals("a b c", StringUtils.normalizeSpace("a\t\f\r b\u000B c\n"));
assertEquals("a b c", StringUtils.normalizeSpace("a\t\f\r " + HARD_SPACE + HARD_SPACE + "b\u000B c\n"));
+ assertEquals("b", StringUtils.normalizeSpace("\u0000b"));
+ assertEquals("b", StringUtils.normalizeSpace("b\u0000"));
}
@Test