Enable and fix 'Statement unnecessarily nested within else clause' warnings

Change-Id: Ida6df4593fc2ab3c11581309b2b4a638229ea093
This commit is contained in:
David Pursehouse
2016-06-01 21:20:02 +09:00
parent b88b47d4b1
commit 323247227d
132 changed files with 542 additions and 724 deletions

View File

@@ -224,9 +224,8 @@ public class RebuildNoteDb extends SiteProgram {
if (threads > 0) {
return MoreExecutors.listeningDecorator(
workQueue.createQueue(threads, "RebuildChange"));
} else {
return MoreExecutors.newDirectExecutorService();
}
return MoreExecutors.newDirectExecutorService();
}
private ImmutableMultimap<Project.NameKey, Change.Id> getChangesByProject()

View File

@@ -363,15 +363,14 @@ public class JettyServer {
// without any wrapping so Jetty has less work to do per-request.
//
return all.get(0);
} else {
// We have more than one path served out of this container so
// combine them in a handler which supports dispatching to the
// individual contexts.
//
final ContextHandlerCollection r = new ContextHandlerCollection();
r.setHandlers(all.toArray(new Handler[0]));
return r;
}
// We have more than one path served out of this container so
// combine them in a handler which supports dispatching to the
// individual contexts.
//
final ContextHandlerCollection r = new ContextHandlerCollection();
r.setHandlers(all.toArray(new Handler[0]));
return r;
}
private ContextHandler makeContext(final String contextPath,

View File

@@ -239,9 +239,8 @@ public class ProjectQoSFilter implements Filter {
String path = m.group(1);
String cmd = m.group(2);
return cmd + " " + path + userName;
} else {
return req.getMethod() + " " + uri + userName;
}
return req.getMethod() + " " + uri + userName;
}
}
}

View File

@@ -145,25 +145,23 @@ class LibraryDownloader {
private boolean shouldGet() {
if (ui.isBatch()) {
return required;
} else {
final StringBuilder msg = new StringBuilder();
msg.append("\n");
msg.append("Gerrit Code Review is not shipped with %s\n");
if (neededBy != null) {
msg.append(String.format(
"** This library is required by %s. **\n",
neededBy.name));
} else if (required) {
msg.append("** This library is required for your configuration. **\n");
} else {
msg.append(" If available, Gerrit can take advantage of features\n");
msg.append(" in the library, but will also function without it.\n");
}
msg.append(String.format(
"%s and install it now", download ? "Download" : "Copy"));
return ui.yesno(true, msg.toString(), name);
}
final StringBuilder msg = new StringBuilder();
msg.append("\n");
msg.append("Gerrit Code Review is not shipped with %s\n");
if (neededBy != null) {
msg.append(String.format(
"** This library is required by %s. **\n",
neededBy.name));
} else if (required) {
msg.append("** This library is required for your configuration. **\n");
} else {
msg.append(" If available, Gerrit can take advantage of features\n");
msg.append(" in the library, but will also function without it.\n");
}
msg.append(String.format(
"%s and install it now", download ? "Download" : "Copy"));
return ui.yesno(true, msg.toString(), name);
}
private void doGet() {

View File

@@ -283,9 +283,8 @@ class UpgradeFrom2_0_x implements InitStep {
}
}
return dbprop;
} else {
return null;
}
return null;
}
@Override

View File

@@ -63,11 +63,10 @@ public class RuntimeShutdown {
tasks.add(newTask);
return true;
} else {
// We don't permit adding a task once shutdown has started.
//
return false;
}
// We don't permit adding a task once shutdown has started.
//
return false;
}
}