Replace indexOf() with a call to the contains()

See gh-15559
pull/15562/head
igor-suhorukov 6 years ago committed by Stephane Nicoll
parent 67eb3b748c
commit b370b1f03a

@ -130,7 +130,7 @@ final class JarURLConnection extends java.net.JarURLConnection {
if (spec.endsWith(SEPARATOR)) { if (spec.endsWith(SEPARATOR)) {
spec = spec.substring(0, spec.length() - SEPARATOR.length()); spec = spec.substring(0, spec.length() - SEPARATOR.length());
} }
if (spec.indexOf(SEPARATOR) == -1) { if (!spec.contains(SEPARATOR)) {
return new URL(spec); return new URL(spec);
} }
return new URL("jar:" + spec); return new URL("jar:" + spec);

@ -91,7 +91,7 @@ class NoUniqueBeanDefinitionFailureAnalyzer
} }
private String[] extractBeanNames(NoUniqueBeanDefinitionException cause) { private String[] extractBeanNames(NoUniqueBeanDefinitionException cause) {
if (cause.getMessage().indexOf("but found") > -1) { if (cause.getMessage().contains("but found")) {
return StringUtils.commaDelimitedListToStringArray(cause.getMessage() return StringUtils.commaDelimitedListToStringArray(cause.getMessage()
.substring(cause.getMessage().lastIndexOf(':') + 1).trim()); .substring(cause.getMessage().lastIndexOf(':') + 1).trim());
} }

@ -114,7 +114,7 @@ public class FilteredConfigurationPropertiesSourceTests {
} }
private boolean noBrackets(ConfigurationPropertyName name) { private boolean noBrackets(ConfigurationPropertyName name) {
return name.toString().indexOf("[") == -1; return !name.toString().contains("[");
} }
} }

@ -57,7 +57,7 @@ public class FilteredIterableConfigurationPropertiesSourceTests
} }
private boolean noBrackets(ConfigurationPropertyName name) { private boolean noBrackets(ConfigurationPropertyName name) {
return name.toString().indexOf("[") == -1; return !name.toString().contains("[");
} }
} }

Loading…
Cancel
Save