Replace 'indexOf()' expression with 'contains()'

Change-Id: I10a5ed7c813af7ab40707369bf4c1953c030b10d
This commit is contained in:
alex.ryazantsev 2013-12-04 01:15:19 +04:00
parent 2ede20d73d
commit db721d46f0
6 changed files with 9 additions and 9 deletions

View File

@ -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) {

View File

@ -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";

View File

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

View File

@ -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.");

View File

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

View File

@ -33,7 +33,7 @@ public final class HostPlatform {
}
});
return osDotName != null
&& osDotName.toLowerCase().indexOf("windows") != -1;
&& osDotName.toLowerCase().contains("windows");
}
private HostPlatform() {