Merge branch '5.3.x'
This commit is contained in:
commit
cce61c3918
|
|
@ -1301,7 +1301,7 @@ public abstract class StringUtils {
|
|||
|
||||
int totalLength = coll.size() * (prefix.length() + suffix.length()) + (coll.size() - 1) * delim.length();
|
||||
for (Object element : coll) {
|
||||
totalLength += element.toString().length();
|
||||
totalLength += String.valueOf(element).length();
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder(totalLength);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
@ -777,4 +778,9 @@ class StringUtilsTests {
|
|||
assertThat(StringUtils.split(null, null)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void collectionToDelimitedStringWithNullValuesShouldNotFail() {
|
||||
assertThat(StringUtils.collectionToCommaDelimitedString(Collections.singletonList(null))).isEqualTo("null");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue