Replace contains() with indexOf()

Closes gh-11373
This commit is contained in:
Johnny Lim 2017-12-19 00:22:35 +09:00 committed by Stephane Nicoll
parent 544c40d46d
commit 4cc598ac5e
5 changed files with 10 additions and 9 deletions

View File

@ -95,8 +95,8 @@ public class AuditEvent implements Serializable {
private static Map<String, Object> convert(String[] data) {
Map<String, Object> result = new HashMap<>();
for (String entry : data) {
if (entry.contains("=")) {
int index = entry.indexOf("=");
int index = entry.indexOf("=");
if (index != -1) {
result.put(entry.substring(0, index), entry.substring(index + 1));
}
else {

View File

@ -39,7 +39,6 @@ public class Link {
public Link(String href) {
this.href = href;
this.templated = href.contains("{");
}
/**

View File

@ -303,8 +303,9 @@ public class ServerProperties {
public String getServletPrefix() {
String result = this.path;
if (result.contains("*")) {
result = result.substring(0, result.indexOf("*"));
int index = result.indexOf("*");
if (index != -1) {
result = result.substring(0, index);
}
if (result.endsWith("/")) {
result = result.substring(0, result.length() - 1);

View File

@ -498,8 +498,8 @@ public class PropertiesLauncher extends Launcher {
// If home dir is same as parent archive, no need to add it twice.
return null;
}
if (root.contains("!")) {
int index = root.indexOf("!");
int index = root.indexOf("!");
if (index != -1) {
File file = new File(this.home, root.substring(0, index));
if (root.startsWith("jar:file:")) {
file = new File(root.substring("jar:file:".length(), index));

View File

@ -109,8 +109,9 @@ class DocumentRoot {
else {
path = location.toURI().getPath();
}
if (path.contains("!/")) {
path = path.substring(0, path.indexOf("!/"));
int index = path.indexOf("!/");
if (index != -1) {
path = path.substring(0, index);
}
return new File(path);
}