diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/UserAgentRule.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/UserAgentRule.java index 366b6c57a3..758578c643 100644 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/UserAgentRule.java +++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/UserAgentRule.java @@ -45,13 +45,13 @@ public class UserAgentRule implements Rule { ua = ua.toLowerCase(); - if (ua.indexOf("opera") != -1) { + if (ua.contains("opera")) { return "opera"; - } else if (ua.indexOf("webkit") != -1) { + } else if (ua.contains("webkit")) { return "safari"; - } else if (ua.indexOf("msie") != -1) { + } else if (ua.contains("msie")) { // GWT 2.0 uses document.documentMode here, which we can't do // on the server side. @@ -73,7 +73,7 @@ public class UserAgentRule implements Rule { } return null; - } else if (ua.indexOf("gecko") != -1) { + } else if (ua.contains("gecko")) { Matcher m = gecko.matcher(ua); if (m.matches() && m.groupCount() == 2) { if (makeVersion(m) >= 1008) { diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java index 0769865cf2..6aa3895613 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java @@ -123,7 +123,7 @@ class GitWebServlet extends HttpServlet { if (!_env.envMap.containsKey("SystemRoot")) { String os = System.getProperty("os.name"); - if (os != null && os.toLowerCase().indexOf("windows") != -1) { + if (os != null && os.toLowerCase().contains("windows")) { String sysroot = System.getenv("SystemRoot"); if (sysroot == null || sysroot.isEmpty()) { sysroot = "C:\\WINDOWS"; diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java index 636ccaf48c..983d5dae60 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java @@ -931,7 +931,7 @@ public class RestApiServlet extends HttpServlet { private static boolean acceptsGzip(HttpServletRequest req) { if (req != null) { String accepts = req.getHeader(HttpHeaders.ACCEPT_ENCODING); - return accepts != null && accepts.indexOf("gzip") != -1; + return accepts != null && accepts.contains("gzip"); } return false; } diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java index bc55b3c960..c2a52ece3e 100644 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java +++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java @@ -61,7 +61,7 @@ final class ProxyUtil { return; } - final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); + final URL u = new URL((!s.contains("://")) ? "http://" + s : s); if (!"http".equals(u.getProtocol())) { throw new MalformedURLException("Invalid http_proxy: " + s + ": Only http supported."); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_81.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_81.java index bc3b3907c6..1e3b2b7be5 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_81.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_81.java @@ -80,7 +80,7 @@ public class Schema_81 extends SchemaVersion { public boolean accept(File pathname) { String n = pathname.getName(); return (n.endsWith(".jar") || n.endsWith(".jar.disabled")) - && pathname.isFile() && n.indexOf("replication") >= 0; + && pathname.isFile() && n.contains("replication"); } }); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/util/HostPlatform.java b/gerrit-server/src/main/java/com/google/gerrit/server/util/HostPlatform.java index 09594e2d6d..ea4b7f9842 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/util/HostPlatform.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/util/HostPlatform.java @@ -33,7 +33,7 @@ public final class HostPlatform { } }); return osDotName != null - && osDotName.toLowerCase().indexOf("windows") != -1; + && osDotName.toLowerCase().contains("windows"); } private HostPlatform() {