Replace 'indexOf()' expression with 'contains()'
Change-Id: Ida566a24d78174690b11d758c769b1d559b7fae9
This commit is contained in:
@@ -53,7 +53,7 @@ public abstract class CherryPickDialog extends ActionDialog {
|
|||||||
LinkedList<BranchSuggestion> suggestions =
|
LinkedList<BranchSuggestion> suggestions =
|
||||||
new LinkedList<BranchSuggestion>();
|
new LinkedList<BranchSuggestion>();
|
||||||
for (final BranchInfo b : branches) {
|
for (final BranchInfo b : branches) {
|
||||||
if (b.ref().indexOf(request.getQuery()) >= 0) {
|
if (b.ref().contains(request.getQuery())) {
|
||||||
suggestions.add(new BranchSuggestion(b));
|
suggestions.add(new BranchSuggestion(b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,7 @@ public class MorphingTabPanel extends TabPanel {
|
|||||||
|
|
||||||
public void setVisible(Widget w, boolean visible) {
|
public void setVisible(Widget w, boolean visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (visibles.indexOf(w) == -1) {
|
if (!visibles.contains(w)) {
|
||||||
int origPos = widgets.indexOf(w);
|
int origPos = widgets.indexOf(w);
|
||||||
|
|
||||||
/* Re-insert the widget right after the first visible widget found
|
/* Re-insert the widget right after the first visible widget found
|
||||||
|
@@ -151,7 +151,7 @@ public class StaticServlet extends HttpServlet {
|
|||||||
|
|
||||||
private static boolean isUnreasonableName(String name) {
|
private static boolean isUnreasonableName(String name) {
|
||||||
if (name.length() < 1) return true;
|
if (name.length() < 1) return true;
|
||||||
if (name.indexOf('\\') >= 0) return true; // no windows/dos stlye paths
|
if (name.contains("\\")) return true; // no windows/dos style paths
|
||||||
if (name.startsWith("../")) return true; // no "../etc/passwd"
|
if (name.startsWith("../")) return true; // no "../etc/passwd"
|
||||||
if (name.contains("/../")) return true; // no "foo/../etc/passwd"
|
if (name.contains("/../")) return true; // no "foo/../etc/passwd"
|
||||||
if (name.contains("/./")) return true; // "foo/./foo" is insane to ask
|
if (name.contains("/./")) return true; // "foo/./foo" is insane to ask
|
||||||
|
@@ -288,10 +288,10 @@ public final class GerritLauncher {
|
|||||||
// match the name it was in the archive.
|
// match the name it was in the archive.
|
||||||
//
|
//
|
||||||
String name = ze.getName();
|
String name = ze.getName();
|
||||||
if (0 <= name.lastIndexOf('/')) {
|
if (name.contains("/")) {
|
||||||
name = name.substring(name.lastIndexOf('/') + 1);
|
name = name.substring(name.lastIndexOf('/') + 1);
|
||||||
}
|
}
|
||||||
if (0 <= name.lastIndexOf('.')) {
|
if (name.contains(".")) {
|
||||||
name = name.substring(0, name.lastIndexOf('.'));
|
name = name.substring(0, name.lastIndexOf('.'));
|
||||||
}
|
}
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
|
@@ -62,7 +62,7 @@ public interface EmailExpander {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExpand(final String user) {
|
public boolean canExpand(final String user) {
|
||||||
return user.indexOf(' ') < 0;
|
return !user.contains(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String expand(final String user) {
|
public String expand(final String user) {
|
||||||
|
Reference in New Issue
Block a user