LANG-1226: StringUtils#normalizeSpace does not trim the string anymore (closes #150)

This commit is contained in:
pascalschumacher 2016-05-21 18:13:03 +02:00
parent ed14537b80
commit 7e85d1cf54
3 changed files with 4 additions and 1 deletions

View File

@ -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>

View File

@ -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();
}
/**

View File

@ -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