Merge pull request #15559 from igor-suhorukov
* pr/15559: Polish "Replace indexOf() with a call to the contains()" Replace indexOf() with a call to the contains()
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class FilteredConfigurationPropertiesSourceTests {
|
||||
}
|
||||
|
||||
private boolean noBrackets(ConfigurationPropertyName name) {
|
||||
return name.toString().indexOf("[") == -1;
|
||||
return !name.toString().contains("[");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class FilteredIterableConfigurationPropertiesSourceTests
|
||||
}
|
||||
|
||||
private boolean noBrackets(ConfigurationPropertyName name) {
|
||||
return name.toString().indexOf("[") == -1;
|
||||
return !name.toString().contains("[");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user