Merge pull request #11373 from izeye:contains

* pr/11373:
  Replace contains() with indexOf()
pull/11400/merge
Stephane Nicoll 7 years ago
commit 691183a66e

@ -95,8 +95,8 @@ public class AuditEvent implements Serializable {
private static Map<String, Object> convert(String[] data) { private static Map<String, Object> convert(String[] data) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
for (String entry : data) { 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)); result.put(entry.substring(0, index), entry.substring(index + 1));
} }
else { else {

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

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

@ -498,8 +498,8 @@ public class PropertiesLauncher extends Launcher {
// If home dir is same as parent archive, no need to add it twice. // If home dir is same as parent archive, no need to add it twice.
return null; 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)); File file = new File(this.home, root.substring(0, index));
if (root.startsWith("jar:file:")) { if (root.startsWith("jar:file:")) {
file = new File(root.substring("jar:file:".length(), index)); file = new File(root.substring("jar:file:".length(), index));

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

Loading…
Cancel
Save