From bf251ea0e844c1269256845ac032a44a49a9e88a Mon Sep 17 00:00:00 2001 From: Carsten Hammer Date: Sat, 6 Apr 2019 19:06:58 +0200 Subject: [PATCH] Replace usage of String.indexOf with String.contains where possible Change-Id: Iad3fce891077d85cf2533272c54206c33c37afd8 Signed-off-by: Carsten Hammer Signed-off-by: David Pursehouse --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java | 2 +- .../src/org/eclipse/jgit/transport/TransportHttp.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index ad10ec9e4..c7e4bad94 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -395,7 +395,7 @@ public class Main { } 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)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index 8b41ab046..9dacaec88 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -779,7 +779,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } // 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