Replace 'indexOf()' expression with 'contains()'
Change-Id: Ida566a24d78174690b11d758c769b1d559b7fae9
This commit is contained in:
parent
258f57aff5
commit
c7dbfed9f0
@ -53,7 +53,7 @@ public abstract class CherryPickDialog extends ActionDialog {
|
||||
LinkedList<BranchSuggestion> suggestions =
|
||||
new LinkedList<BranchSuggestion>();
|
||||
for (final BranchInfo b : branches) {
|
||||
if (b.ref().indexOf(request.getQuery()) >= 0) {
|
||||
if (b.ref().contains(request.getQuery())) {
|
||||
suggestions.add(new BranchSuggestion(b));
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class MorphingTabPanel extends TabPanel {
|
||||
|
||||
public void setVisible(Widget w, boolean visible) {
|
||||
if (visible) {
|
||||
if (visibles.indexOf(w) == -1) {
|
||||
if (!visibles.contains(w)) {
|
||||
int origPos = widgets.indexOf(w);
|
||||
|
||||
/* 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) {
|
||||
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.contains("/../")) return true; // no "foo/../etc/passwd"
|
||||
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.
|
||||
//
|
||||
String name = ze.getName();
|
||||
if (0 <= name.lastIndexOf('/')) {
|
||||
if (name.contains("/")) {
|
||||
name = name.substring(name.lastIndexOf('/') + 1);
|
||||
}
|
||||
if (0 <= name.lastIndexOf('.')) {
|
||||
if (name.contains(".")) {
|
||||
name = name.substring(0, name.lastIndexOf('.'));
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
|
@ -62,7 +62,7 @@ public interface EmailExpander {
|
||||
|
||||
@Override
|
||||
public boolean canExpand(final String user) {
|
||||
return user.indexOf(' ') < 0;
|
||||
return !user.contains(" ");
|
||||
}
|
||||
|
||||
public String expand(final String user) {
|
||||
|
Loading…
Reference in New Issue
Block a user