String.indexOf can be replaced with String.contains
Change-Id: I2e333cc3bc8ffdd1abe5cf9aef7e7b34954d513b
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Also-by: Karsten Thoms <karsten.thoms@itemis.de>
diff --git a/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/AntDebugState.java b/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/AntDebugState.java
index 85b7373..20b8395 100644
--- a/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/AntDebugState.java
+++ b/ant/org.eclipse.ant.launching/common/org/eclipse/ant/internal/launching/debug/AntDebugState.java
@@ -526,8 +526,9 @@
}
private String escapeLineSeparator(String stringToEscape) {
- if (!(stringToEscape.indexOf('\r') != -1 || stringToEscape.indexOf('\n') != -1 || stringToEscape.indexOf("\\r") != -1 //$NON-NLS-1$
- || stringToEscape.indexOf("\\n") != -1)) { //$NON-NLS-1$
+ if (!(stringToEscape.indexOf('\r') != -1 || stringToEscape.indexOf('\n') != -1 || stringToEscape.contains("\\r") //$NON-NLS-1$
+
+ || stringToEscape.contains("\\n"))) { //$NON-NLS-1$
return stringToEscape;
}
StringBuilder escapedValue = new StringBuilder(stringToEscape);
diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java
index c56b78f..7a9ca3d 100644
--- a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java
+++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/debug/model/RemoteAntDebugBuildListener.java
@@ -118,7 +118,7 @@
fTarget.suspended(DebugEvent.CLIENT_REQUEST);
} else if (message.endsWith(DebugMessageIds.STEP)) {
fTarget.suspended(DebugEvent.STEP_END);
- } else if (message.indexOf(DebugMessageIds.BREAKPOINT) >= 0) {
+ } else if (message.contains(DebugMessageIds.BREAKPOINT)) {
fTarget.breakpointHit(message);
}
}
diff --git a/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java b/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java
index 03eb521..4f8eddf 100644
--- a/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java
+++ b/ant/org.eclipse.ant.tests.core/tests/org/eclipse/ant/tests/core/tests/OptionTests.java
@@ -302,9 +302,9 @@
*/
public void testSpecifyBadTargetAsArg() throws CoreException {
run("TestForEcho.xml", new String[] { "echo2" }, false); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(1).indexOf("Unknown target") >= 0); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(1).indexOf("echo2") >= 0); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Should be a no known target message", AntTestChecker.getDefault().getLoggedMessage(0).indexOf("No known target specified.") >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(1).contains("Unknown target")); //$NON-NLS-1$//$NON-NLS-2$
+ assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(1).contains("echo2")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Should be a no known target message", AntTestChecker.getDefault().getLoggedMessage(0).contains("No known target specified.")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Should not have run any targets", 0, AntTestChecker.getDefault().getTargetsStartedCount()); //$NON-NLS-1$
}
@@ -314,8 +314,8 @@
*/
public void testSpecifyBothBadAndGoodTargetsAsArg() throws CoreException {
run("TestForEcho.xml", new String[] { "echo2", "Test for Echo" }, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(5).indexOf("Unknown target") >= 0); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(5).indexOf("echo2") >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(5).contains("Unknown target")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Should be an unknown target message", AntTestChecker.getDefault().getLoggedMessage(5).contains("echo2")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Should have run the Test for Echo target", 5, AntTestChecker.getDefault().getTargetsStartedCount()); //$NON-NLS-1$
}
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/AntEditorTests.java b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/AntEditorTests.java
index 96871f3..d015bcc 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/AntEditorTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Editor Tests/org/eclipse/ant/tests/ui/editor/AntEditorTests.java
@@ -102,18 +102,18 @@
IRegion region = hover.getHoverRegion(editor.getViewer(), offset);
String hoverText = hover.getHoverInfo(editor.getViewer(), region);
assertNotNull("Expecting a hovertext object", hoverText); //$NON-NLS-1$
- assertTrue("Expected to see '<h5>Includes:</h5><li>include</li>'", hoverText.indexOf("<h5>Includes:</h5><li>include</li>") > -1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Expected to see '<h5>Excludes:</h5><li>exclude</li>'", hoverText.indexOf("<h5>Excludes:</h5><li>exclude</li>") > -1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Expected to see '<h5>Includes:</h5><li>include</li>'", hoverText.contains("<h5>Includes:</h5><li>include</li>")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Expected to see '<h5>Excludes:</h5><li>exclude</li>'", hoverText.contains("<h5>Excludes:</h5><li>exclude</li>")); //$NON-NLS-1$ //$NON-NLS-2$
String text = "<li>**" + File.separator + "SCCS" + File.separator + "**</li>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertTrue("Expected to see '<li>**/SCCS/**</li>'", hoverText.indexOf(text) > -1); //$NON-NLS-1$
+ assertTrue("Expected to see '<li>**/SCCS/**</li>'", hoverText.contains(text)); //$NON-NLS-1$
text = "<li>**" + File.separator + ".DS_Store</li>"; //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Expected to see '<li>**/.DS_Store</li>'", hoverText.indexOf(text) > -1); //$NON-NLS-1$
+ assertTrue("Expected to see '<li>**/.DS_Store</li>'", hoverText.contains(text)); //$NON-NLS-1$
text = "<li>**" + File.separator + ".bzrignore</li>"; //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Expected to see '<li>**/.bzrignore</li>'", hoverText.indexOf(text) > -1); //$NON-NLS-1$
+ assertTrue("Expected to see '<li>**/.bzrignore</li>'", hoverText.contains(text)); //$NON-NLS-1$
text = "<li>**" + File.separator + ".gitattributes</li>"; //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Expected to see '<li>**/.gitattributes</li>'", hoverText.indexOf(text) > -1); //$NON-NLS-1$
+ assertTrue("Expected to see '<li>**/.gitattributes</li>'", hoverText.contains(text)); //$NON-NLS-1$
text = "<li>**" + File.separator + ".hgtags</li>"; //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Expected to see '<li>**/.hgtags</li>'", hoverText.indexOf(text) > -1); //$NON-NLS-1$
+ assertTrue("Expected to see '<li>**/.hgtags</li>'", hoverText.contains(text)); //$NON-NLS-1$
}
public void testTaskdefOpenDeclaration() throws PartInitException, BadLocationException {
@@ -273,7 +273,7 @@
assertNotNull("The selected region for the augmented element cannot be null", region); //$NON-NLS-1$
String text = hover.getHoverInfo(editor.getViewer(), region);
assertNotNull("The hover text for the path element must not be null", text); //$NON-NLS-1$
- assertTrue("The hover text must contain the augmented element 'foo'", text.indexOf("foo") > -1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("The hover text must contain the augmented element 'foo'", text.contains("foo")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/OpenExternalAntDocHandler.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/OpenExternalAntDocHandler.java
index 5dd0898..bbb6241 100644
--- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/OpenExternalAntDocHandler.java
+++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/actions/OpenExternalAntDocHandler.java
@@ -148,7 +148,7 @@
return null;
}
String className = definition.getClassName();
- if (className.indexOf("taskdef") != -1) { //$NON-NLS-1$
+ if (className.contains("taskdef")) { //$NON-NLS-1$
return "Tasks"; //$NON-NLS-1$
}
return "Types"; //$NON-NLS-1$
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java
index 6258033..3e45eff 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUIPlugin.java
@@ -221,7 +221,7 @@
*/
public static boolean isMacOS() {
String osname = System.getProperty("os.name").toLowerCase(Locale.US); //$NON-NLS-1$
- return osname.indexOf("mac") != -1; //$NON-NLS-1$
+ return osname.contains("mac"); //$NON-NLS-1$
}
/**
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/ExportUtil.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/ExportUtil.java
index 489e62c..99c2dea 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/ExportUtil.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/ExportUtil.java
@@ -561,7 +561,7 @@
String warning = BuildFileCreator.WARNING.substring(0, i);
String line;
while ((line = in.readLine()) != null) {
- if (line.indexOf(warning) != -1) {
+ if (line.contains(warning)) {
return false;
}
}
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntAugmentTaskNode.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntAugmentTaskNode.java
index bdba43d..423adbe 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntAugmentTaskNode.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntAugmentTaskNode.java
@@ -83,7 +83,7 @@
if (!prop) {
return identifier.equals(attrId);
}
- return attrId != null && identifier.indexOf(attrId) > -1;
+ return attrId != null && identifier.contains(attrId);
}
return false;
}
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntPropertyNode.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntPropertyNode.java
index 123c157..b700edf 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntPropertyNode.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntPropertyNode.java
@@ -178,7 +178,7 @@
}
if (fValue != null) {
- return fValue.indexOf(identifier) != -1;
+ return fValue.contains(identifier);
}
return false;
}
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntTaskNode.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntTaskNode.java
index 482679a..0499356 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntTaskNode.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntTaskNode.java
@@ -165,10 +165,10 @@
String key = iter.next();
String value = (String) attributeMap.get(key);
if (lookingForProperty && (key.equals("if") || key.equals("unless"))) { //$NON-NLS-1$ //$NON-NLS-2$
- if (value.indexOf(identifier.substring(2, identifier.length() - 1)) != -1) {
+ if (value.contains(identifier.substring(2, identifier.length() - 1))) {
return true;
}
- } else if (value.indexOf(identifier) != -1) {
+ } else if (value.contains(identifier)) {
return true;
}
}
@@ -197,7 +197,7 @@
String key = iter.next();
String value = (String) attributeMap.get(key);
int identifierCorrection = 1;
- if (value.indexOf(identifier) != -1) {
+ if (value.contains(identifier)) {
int keyOffset = textToSearch.indexOf(key);
while (keyOffset > 0 && !Character.isWhitespace(textToSearch.charAt(keyOffset - 1))) {
keyOffset = textToSearch.indexOf(key, keyOffset + 1);
diff --git a/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF b/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF
index 9a08f50..20975ed 100644
--- a/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF
+++ b/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.update.configurator; singleton:=true
-Bundle-Version: 3.4.300.qualifier
+Bundle-Version: 3.4.400.qualifier
Bundle-Activator: org.eclipse.update.internal.configurator.ConfigurationActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/update/org.eclipse.update.configurator/pom.xml b/update/org.eclipse.update.configurator/pom.xml
index 9dc8747..5619987 100644
--- a/update/org.eclipse.update.configurator/pom.xml
+++ b/update/org.eclipse.update.configurator/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.update</groupId>
<artifactId>org.eclipse.update.configurator</artifactId>
- <version>3.4.300-SNAPSHOT</version>
+ <version>3.4.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java
index 618dc20..98edf85 100644
--- a/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java
+++ b/update/org.eclipse.update.configurator/src/org/eclipse/update/internal/configurator/Utils.java
@@ -268,7 +268,7 @@
StringTokenizer stok = new StringTokenizer(candidateValues, ","); //$NON-NLS-1$
while (stok.hasMoreTokens()) {
String token = stok.nextToken().toUpperCase();
- if (siteValues.indexOf(token)!=-1) return true;
+ if (siteValues.contains(token)) return true;
}
return false;
}
@@ -375,7 +375,7 @@
}
public static boolean isAutomaticallyStartedBundle(String bundleURL) {
- if (bundleURL.indexOf("org.eclipse.osgi") != -1) //$NON-NLS-1$
+ if (bundleURL.contains("org.eclipse.osgi")) //$NON-NLS-1$
return true;
String osgiBundles = ConfigurationActivator.getBundleContext().getProperty("osgi.bundles"); //$NON-NLS-1$
@@ -387,10 +387,10 @@
token = token.substring(0,index);
if (token.startsWith("reference:file:")) { //$NON-NLS-1$
File f = new File(token.substring(15));
- if (bundleURL.indexOf(f.getName()) != -1)
+ if (bundleURL.contains(f.getName()))
return true;
}
- if (bundleURL.indexOf(token) != -1)
+ if (bundleURL.contains(token))
return true;
}
return false;