diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java index db34f47c0e..c497346d20 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java @@ -130,7 +130,7 @@ final class JarURLConnection extends java.net.JarURLConnection { if (spec.endsWith(SEPARATOR)) { spec = spec.substring(0, spec.length() - SEPARATOR.length()); } - if (spec.indexOf(SEPARATOR) == -1) { + if (!spec.contains(SEPARATOR)) { return new URL(spec); } return new URL("jar:" + spec); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzer.java index 7f16a51ff6..50808d2724 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzer.java @@ -91,7 +91,7 @@ class NoUniqueBeanDefinitionFailureAnalyzer } private String[] extractBeanNames(NoUniqueBeanDefinitionException cause) { - if (cause.getMessage().indexOf("but found") > -1) { + if (cause.getMessage().contains("but found")) { return StringUtils.commaDelimitedListToStringArray(cause.getMessage() .substring(cause.getMessage().lastIndexOf(':') + 1).trim()); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java index 8f3d2d4d4b..9bdb10b9c4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java @@ -114,7 +114,7 @@ public class FilteredConfigurationPropertiesSourceTests { } private boolean noBrackets(ConfigurationPropertyName name) { - return name.toString().indexOf("[") == -1; + return !name.toString().contains("["); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java index 7e910f1bfe..fd54f09884 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredIterableConfigurationPropertiesSourceTests.java @@ -57,7 +57,7 @@ public class FilteredIterableConfigurationPropertiesSourceTests } private boolean noBrackets(ConfigurationPropertyName name) { - return name.toString().indexOf("[") == -1; + return !name.toString().contains("["); } }