Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-04-18 15:30:43 -0400
committerMichael Keppler2019-04-26 11:32:42 -0400
commita2962166dc7668df4614605d16045b0891e49e52 (patch)
tree2f8c41918c1746e0ccc6a03dbd45a0f72558adb9
parent1ec405f058b677b8d83234d8fffa132f800cefd7 (diff)
downloadegit-a2962166dc7668df4614605d16045b0891e49e52.tar.gz
egit-a2962166dc7668df4614605d16045b0891e49e52.tar.xz
egit-a2962166dc7668df4614605d16045b0891e49e52.zip
Replace usage of String.indexOf with String.contains where possible
Change-Id: I6976afb1bc4524a860eec3bfe11c963858419e76 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java4
3 files changed, 4 insertions, 5 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java
index 9c92877b1..6ed7f0764 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java
@@ -213,8 +213,7 @@ public class StagingViewTest extends AbstractStagingViewTestCase {
commitMessage.indexOf("Signed-off-by") > 0);
stagingViewTester.setSignedOff(false);
commitMessage = stagingViewTester.getCommitMessage();
- assertTrue("Should not have a signed-off footer",
- commitMessage.indexOf("Signed-off-by") < 0);
+ assertTrue("Should not have a signed-off footer", !commitMessage.contains("Signed-off-by"));
StoredConfig cfg = repository.getConfig();
cfg.load();
cfg.setString(ConfigConstants.CONFIG_USER_SECTION, null,
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java
index f856a150b..f718f3f6d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java
@@ -133,7 +133,7 @@ public class ConfigurationChecker {
} catch (RuntimeException e) {
return false;
}
- return os.indexOf("Windows") != -1; //$NON-NLS-1$
+ return os.contains("Windows"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java
index efc2aa902..f748f2e92 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java
@@ -87,9 +87,9 @@ public class FindToolbarJob extends Job {
return false;
}
if (ignoreCase) {
- return text.toLowerCase().indexOf(needle) >= 0;
+ return text.toLowerCase().contains(needle);
}
- return text.indexOf(needle) >= 0;
+ return text.contains(needle);
}
@Override

Back to the top