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

See gh-15559
This commit is contained in:
igor-suhorukov
2018-12-24 07:59:43 +03:00
committed by Stephane Nicoll
parent 67eb3b748c
commit b370b1f03a
4 changed files with 4 additions and 4 deletions

View File

@@ -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());
}

View File

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

View File

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