* pr/10077: Avoid substring() invocation when the result is itself
@ -73,7 +73,7 @@ public abstract class EnvironmentTestUtils {
Map<String, Object> map = getOrAdd(sources, name);
for (String pair : pairs) {
int index = getSeparatorIndex(pair);
String key = pair.substring(0, index > 0 ? index : pair.length());
String key = index > 0 ? pair.substring(0, index) : pair;
String value = index > 0 ? pair.substring(index + 1) : "";
map.put(key.trim(), value.trim());
}
@ -253,7 +253,7 @@ public final class TestPropertyValues {
public static Pair parse(String pair) {
return of(key.trim(), value.trim());
@ -395,7 +395,7 @@ public class SpringApplicationBuilder {
Map<String, Object> map = new HashMap<>();
for (String property : properties) {
int index = lowestIndexOf(property, ":", "=");
String key = property.substring(0, index > 0 ? index : property.length());
String key = index > 0 ? property.substring(0, index) : property;
String value = index > 0 ? property.substring(index + 1) : "";
map.put(key, value);
@ -102,7 +102,7 @@ public class BindFailureAnalyzerTests {
for (String pair : environment) {
int index = pair.indexOf("=");
@ -135,7 +135,7 @@ public class BindValidationFailureAnalyzerTests {
@ -98,7 +98,7 @@ public class UnboundConfigurationPropertyFailureAnalyzerTests {