Replace usage of String.indexOf with String.contains where possible

Change-Id: Iad3fce891077d85cf2533272c54206c33c37afd8
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
Carsten Hammer 2019-04-06 19:06:58 +02:00 committed by David Pursehouse
parent dff4f6cc74
commit bf251ea0e8
2 changed files with 2 additions and 2 deletions

View File

@ -395,7 +395,7 @@ static void configureHttpProxy() throws MalformedURLException {
}
final URL u = new URL(
(s.indexOf("://") == -1) ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$
(!s.contains("://")) ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$
if (!u.getProtocol().startsWith("http")) //$NON-NLS-1$
throw new MalformedURLException(MessageFormat.format(
CLIText.get().invalidHttpProxyOnlyHttpSupported, s));

View File

@ -779,7 +779,7 @@ private boolean isValidRedirect(URL current, String next, String checkFor) {
}
// git allows only rewriting the root, i.e., everything before INFO_REFS
// or the service name
if (next.indexOf(checkFor) < 0) {
if (!next.contains(checkFor)) {
return false;
}
// Basically we should test here that whatever follows INFO_REFS is