From 53597f90e9e7da2739da9b874d16a4b1c5c50c10 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 28 May 2019 18:31:54 +0200 Subject: [PATCH] Remove dependency on StringUtils in SortedProperties See gh-23018, gh-22383 --- .../java/org/springframework/core/SortedProperties.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/SortedProperties.java b/spring-core/src/main/java/org/springframework/core/SortedProperties.java index 1a979d39ed..beb211f8d8 100644 --- a/spring-core/src/main/java/org/springframework/core/SortedProperties.java +++ b/spring-core/src/main/java/org/springframework/core/SortedProperties.java @@ -30,8 +30,6 @@ import java.util.Properties; import java.util.Set; import java.util.TreeSet; -import org.springframework.util.StringUtils; - /** * Specialization of {@link Properties} that sorts properties alphanumerically * based on their keys. @@ -94,7 +92,7 @@ class SortedProperties extends Properties { ByteArrayOutputStream baos = new ByteArrayOutputStream(); super.store(baos, (this.omitComments ? null : comments)); String contents = new String(baos.toByteArray(), StandardCharsets.ISO_8859_1); - for (String line : StringUtils.tokenizeToStringArray(contents, EOL)) { + for (String line : contents.split(EOL)) { if (!this.omitComments || !line.startsWith("#")) { out.write((line + EOL).getBytes(StandardCharsets.ISO_8859_1)); } @@ -106,7 +104,7 @@ class SortedProperties extends Properties { StringWriter stringWriter = new StringWriter(); super.store(stringWriter, (this.omitComments ? null : comments)); String contents = stringWriter.toString(); - for (String line : StringUtils.tokenizeToStringArray(contents, EOL)) { + for (String line : contents.split(EOL)) { if (!this.omitComments || !line.startsWith("#")) { writer.write(line + EOL); }