Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-06-17 06:17:30 -0400
committerLars Vogel2019-06-17 06:17:30 -0400
commit6569f47ad4c87c209624b2171720e1f72ea89bf3 (patch)
treeaf744be8e44746d4ce031edcd2524e16ead6f4e3
parent90106a4878f52e85f9c9d3b799add2c270573a8e (diff)
downloadeclipse.platform.team-6569f47ad4c87c209624b2171720e1f72ea89bf3.tar.gz
eclipse.platform.team-6569f47ad4c87c209624b2171720e1f72ea89bf3.tar.xz
eclipse.platform.team-6569f47ad4c87c209624b2171720e1f72ea89bf3.zip
Use String.contains instead of indexOf
Change-Id: I46605c9328b8f30d8a48737681adfb71c31e9183 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/JSchSession.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java2
9 files changed, 13 insertions, 13 deletions
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
index d96831e5d..f213b710b 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
@@ -1409,7 +1409,7 @@ protected Control createContents(Composite parent){
session.setTimeout(timeout);
try {
service.connect(session, timeout, new NullProgressMonitor());
- if(session.getServerVersion().indexOf("OpenSSH")==-1){ //$NON-NLS-1$
+ if(!session.getServerVersion().contains("OpenSSH")){ //$NON-NLS-1$
setErrorMessage(Messages.CVSSSH2PreferencePage_110);
return;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
index dac85d110..d5e1c74c8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
@@ -49,7 +49,7 @@ public class Diff extends Command {
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
for (IStatus child : children) {
- if (child.getMessage().indexOf("[diff aborted]") != -1) { //$NON-NLS-1$
+ if (child.getMessage().contains("[diff aborted]")) { //$NON-NLS-1$
throw new CVSServerException(status);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
index 3084fb890..f1fe64e41 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
@@ -261,11 +261,11 @@ public class LogListener extends CommandOutputListener {
*
*/
private String getBranchRevision(String revision) {
- if (revision.length() == 0 || revision.lastIndexOf(".") == -1) //$NON-NLS-1$
+ if (revision.length() == 0 || !revision.contains(".")) //$NON-NLS-1$
throw new IllegalArgumentException(
"Revision malformed: " + revision); //$NON-NLS-1$
String branchNumber = revision.substring(0, revision.lastIndexOf(".")); //$NON-NLS-1$
- if (branchNumber.lastIndexOf(".") == -1 || branchNumber.equals(CVSTag.VENDOR_REVISION)) { //$NON-NLS-1$
+ if (!branchNumber.contains(".") || branchNumber.equals(CVSTag.VENDOR_REVISION)) { //$NON-NLS-1$
return branchNumber;
}
String branchPrefix = branchNumber.substring(0,
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java
index 729ed06b5..a8f428bb8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java
@@ -80,7 +80,7 @@ public class CVSDateFormatter {
* Timezone string is of the following format: [-|+]MMSS
*/
static private TimeZone getTimeZone(String dateFromServer) {
- if (dateFromServer.lastIndexOf("0000") != -1) //$NON-NLS-1$
+ if (dateFromServer.contains("0000")) //$NON-NLS-1$
return TimeZone.getTimeZone("GMT");//$NON-NLS-1$
String tz = null;
StringBuilder resultTz = new StringBuilder("GMT");//$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java
index 81d352364..6594396b5 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java
@@ -249,12 +249,12 @@ public class CVSSSH2ServerConnection implements IServerConnection {
}
private boolean isChannelNotOpenError(JSchException ee) {
- return ee.getMessage().indexOf("channel is not opened") != -1; //$NON-NLS-1$
+ return ee.getMessage().contains("channel is not opened"); //$NON-NLS-1$
}
private boolean isSessionDownError(JSchException ee) {
return ee.getMessage().equals("session is down"); //$NON-NLS-1$
}
private boolean isSSH2Unsupported(JSchException e) {
- return e.toString().indexOf("invalid server's version string") != -1; //$NON-NLS-1$
+ return e.toString().contains("invalid server's version string"); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/JSchSession.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/JSchSession.java
index 3a7b051d9..14c91c3ad 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/JSchSession.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/JSchSession.java
@@ -99,7 +99,7 @@ class JSchSession {
return jschSession;
} catch (JSchException e) {
pool.remove(key);
- if(e.toString().indexOf("Auth cancel")!=-1){ //$NON-NLS-1$
+ if(e.toString().contains("Auth cancel")){ //$NON-NLS-1$
throw new OperationCanceledException();
}
throw e;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
index 960ab5251..3f1c3f627 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
@@ -70,7 +70,7 @@ public class CVSHistoryFilter extends ViewerFilter {
protected boolean branchMatch(CVSFileRevision revision) {
ITag[] branches = revision.getBranches();
for (ITag branche : branches) {
- if (branche.getName().toLowerCase().indexOf(branchName.toLowerCase()) != -1) {
+ if (branche.getName().toLowerCase().contains(branchName.toLowerCase())) {
return true;
}
}
@@ -82,7 +82,7 @@ public class CVSHistoryFilter extends ViewerFilter {
}
protected boolean commentMatch(CVSFileRevision revision) {
- return !(revision.getComment().toLowerCase().indexOf(comment.toLowerCase()) == -1);
+ return !(!revision.getComment().toLowerCase().contains(comment.toLowerCase()));
}
protected boolean dateMatch(CVSFileRevision revision) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
index 61eeea166..ba9a11858 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
@@ -330,7 +330,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
private IResource getResourceWithSpace() {
for (IResource resource : resources) {
- if (resource.getName().indexOf(" ") != -1) { //$NON-NLS-1$
+ if (resource.getName().contains(" ")) { //$NON-NLS-1$
return resource;
}
}
@@ -339,7 +339,7 @@ public class IgnoreResourcesDialog extends TitleAreaDialog {
private boolean checkIfAllResourcesWithSpacesHaveExtensions() {
for (IResource resource : resources) {
- if (resource.getName().indexOf(" ") != -1 && resource.getFileExtension() == null) { //$NON-NLS-1$
+ if (resource.getName().contains(" ") && resource.getFileExtension() == null) { //$NON-NLS-1$
return false;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
index 99eca7e05..cc1b46e6a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
@@ -250,7 +250,7 @@ public class MergeWizardPage extends CVSWizardPage {
private CVSTag findCommonBaseTag(CVSTag tag) {
CVSTag[] tags = tagSource.getTags(CVSTag.VERSION);
for (CVSTag potentialMatch : tags) {
- if (potentialMatch.getName().indexOf(tag.getName()) != -1) {
+ if (potentialMatch.getName().contains(tag.getName())) {
return potentialMatch;
}
}

Back to the top