Add missing braces around if- for- and while-statements
Change-Id: Ib7d455426fa78ac803f9d5162466f52b973cf998
This commit is contained in:
parent
1abfd35d76
commit
5ddffa0060
@ -136,7 +136,9 @@ public class CommentDetail {
|
||||
parentMap.put(parentUuid, l);
|
||||
}
|
||||
l.add(c);
|
||||
if (parentUuid == null) rootComments.add(c);
|
||||
if (parentUuid == null) {
|
||||
rootComments.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the comments in the list, starting with the head and then going through all the
|
||||
|
@ -125,11 +125,15 @@ public class PermissionRange implements Comparable<PermissionRange> {
|
||||
r.append(' ');
|
||||
} else {
|
||||
if (getMin() != getMax()) {
|
||||
if (0 <= getMin()) r.append('+');
|
||||
if (0 <= getMin()) {
|
||||
r.append('+');
|
||||
}
|
||||
r.append(getMin());
|
||||
r.append("..");
|
||||
}
|
||||
if (0 <= getMax()) r.append('+');
|
||||
if (0 <= getMax()) {
|
||||
r.append('+');
|
||||
}
|
||||
r.append(getMax());
|
||||
r.append(' ');
|
||||
}
|
||||
|
@ -126,8 +126,12 @@ public class PermissionRule implements Comparable<PermissionRule> {
|
||||
@Override
|
||||
public int compareTo(PermissionRule o) {
|
||||
int cmp = action(this) - action(o);
|
||||
if (cmp == 0) cmp = range(o) - range(this);
|
||||
if (cmp == 0) cmp = group(this).compareTo(group(o));
|
||||
if (cmp == 0) {
|
||||
cmp = range(o) - range(this);
|
||||
}
|
||||
if (cmp == 0) {
|
||||
cmp = group(this).compareTo(group(o));
|
||||
}
|
||||
return cmp;
|
||||
}
|
||||
|
||||
|
@ -196,8 +196,9 @@ public abstract class BinaryResult implements Closeable {
|
||||
} catch (UnsupportedCharsetException | CharacterCodingException e) {
|
||||
// Fallback to ISO-8850-1 style encoding.
|
||||
StringBuilder r = new StringBuilder(data.length);
|
||||
for (byte b : data)
|
||||
r.append((char) (b & 0xff));
|
||||
for (byte b : data) {
|
||||
r.append((char) (b & 0xff));
|
||||
}
|
||||
return r.toString();
|
||||
}
|
||||
}
|
||||
|
@ -707,11 +707,13 @@ public class Dispatcher {
|
||||
return new RegisterScreen("/" + skip(token));
|
||||
}
|
||||
|
||||
if (matchPrefix("/VE/", token) || matchPrefix("VE,", token))
|
||||
if (matchPrefix("/VE/", token) || matchPrefix("VE,", token)) {
|
||||
return new ValidateEmailScreen(skip(token));
|
||||
}
|
||||
|
||||
if (matchExact(SETTINGS_NEW_AGREEMENT, token))
|
||||
if (matchExact(SETTINGS_NEW_AGREEMENT, token)) {
|
||||
return new NewAgreementScreen();
|
||||
}
|
||||
|
||||
if (matchPrefix(SETTINGS_NEW_AGREEMENT + "/", token)) {
|
||||
return new NewAgreementScreen(skip(token));
|
||||
|
@ -47,7 +47,9 @@ public class RelativeDateFormatter {
|
||||
long ageMillis = (new Date()).getTime() - when.getTime();
|
||||
|
||||
// shouldn't happen in a perfect world
|
||||
if (ageMillis < 0) return Util.C.inTheFuture();
|
||||
if (ageMillis < 0) {
|
||||
return Util.C.inTheFuture();
|
||||
}
|
||||
|
||||
// seconds
|
||||
if (ageMillis < upperLimit(MINUTE_IN_MILLIS)) {
|
||||
|
@ -61,8 +61,9 @@ public class MyAgreementsScreen extends SettingsScreen {
|
||||
}
|
||||
|
||||
void display(final AgreementInfo result) {
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
for (final String k : result.accepted) {
|
||||
addOne(result, k);
|
||||
|
@ -179,8 +179,9 @@ public class MyIdentitiesScreen extends SettingsScreen {
|
||||
}
|
||||
});
|
||||
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
for (final AccountExternalId k : result) {
|
||||
addOneId(k);
|
||||
|
@ -113,8 +113,9 @@ public class MyWatchesTable extends FancyFlexTable<AccountProjectWatchInfo> {
|
||||
}
|
||||
|
||||
public void display(final List<AccountProjectWatchInfo> result) {
|
||||
while (2 < table.getRowCount())
|
||||
while (2 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
for (final AccountProjectWatchInfo k : result) {
|
||||
final int row = table.getRowCount();
|
||||
|
@ -306,8 +306,9 @@ class SshPanel extends Composite {
|
||||
setKeyTableVisible(false);
|
||||
showAddKeyBlock(true);
|
||||
} else {
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
for (final SshKeyInfo k : result) {
|
||||
addOneKey(k);
|
||||
}
|
||||
|
@ -178,10 +178,11 @@ class UsernameField extends Composite {
|
||||
default:
|
||||
final TextBox box = (TextBox) event.getSource();
|
||||
final String re;
|
||||
if (box.getCursorPos() == 0)
|
||||
if (box.getCursorPos() == 0) {
|
||||
re = Account.USER_NAME_PATTERN_FIRST;
|
||||
else
|
||||
} else {
|
||||
re = Account.USER_NAME_PATTERN_REST;
|
||||
}
|
||||
if (!String.valueOf(code).matches("^" + re + "$")) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -270,8 +270,9 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
|
||||
}
|
||||
|
||||
void display(final List<AccountInfo> result) {
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
for (final AccountInfo i : result) {
|
||||
final int row = table.getRowCount();
|
||||
@ -376,8 +377,9 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
|
||||
}
|
||||
|
||||
void display(List<GroupInfo> list) {
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
for (final GroupInfo i : list) {
|
||||
final int row = table.getRowCount();
|
||||
|
@ -103,8 +103,9 @@ public class GroupTable extends NavigationTable<GroupInfo> {
|
||||
}
|
||||
|
||||
public void displaySubset(List<GroupInfo> list, String toHighlight, int fromIndex, int toIndex) {
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
Collections.sort(list, new Comparator<GroupInfo>() {
|
||||
@Override
|
||||
|
@ -444,8 +444,9 @@ public class ProjectBranchesScreen extends ProjectScreen {
|
||||
void displaySubset(List<BranchInfo> branches, int fromIndex, int toIndex) {
|
||||
canDelete = false;
|
||||
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
for (BranchInfo k : branches.subList(fromIndex, toIndex)) {
|
||||
final int row = table.getRowCount();
|
||||
|
@ -144,7 +144,9 @@ public class AccountDashboardScreen extends Screen implements ChangeListScreen {
|
||||
@Override
|
||||
public int compare(ChangeInfo a, ChangeInfo b) {
|
||||
int cmp = a.created().compareTo(b.created());
|
||||
if (cmp != 0) return cmp;
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
return a._number() - b._number();
|
||||
}
|
||||
};
|
||||
|
@ -65,8 +65,9 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
|
||||
}
|
||||
|
||||
public void displaySubset(ProjectMap projects, int fromIndex, int toIndex) {
|
||||
while (1 < table.getRowCount())
|
||||
while (1 < table.getRowCount()) {
|
||||
table.removeRow(table.getRowCount() - 1);
|
||||
}
|
||||
|
||||
List<ProjectInfo> list = Natives.asList(projects.values());
|
||||
Collections.sort(list, new Comparator<ProjectInfo>() {
|
||||
@ -75,8 +76,9 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
|
||||
return a.name().compareTo(b.name());
|
||||
}
|
||||
});
|
||||
for(ProjectInfo p : list.subList(fromIndex, toIndex))
|
||||
for (ProjectInfo p : list.subList(fromIndex, toIndex)) {
|
||||
insert(table.getRowCount(), p);
|
||||
}
|
||||
|
||||
finishDisplay();
|
||||
}
|
||||
|
@ -260,8 +260,12 @@ class ProjectDigestFilter implements Filter {
|
||||
} else {
|
||||
int space = auth.indexOf(' ', eq + 1);
|
||||
int comma = auth.indexOf(',', eq + 1);
|
||||
if (space < 0) space = auth.length();
|
||||
if (comma < 0) comma = auth.length();
|
||||
if (space < 0) {
|
||||
space = auth.length();
|
||||
}
|
||||
if (comma < 0) {
|
||||
comma = auth.length();
|
||||
}
|
||||
|
||||
final int e = Math.min(space, comma);
|
||||
value = auth.substring(eq + 1, e);
|
||||
|
@ -201,8 +201,9 @@ class AccountServiceImpl extends BaseServiceImplementation implements
|
||||
public VoidResult run(final ReviewDb db) throws OrmException, Failure {
|
||||
final Account.Id me = getAccountId();
|
||||
for (final AccountProjectWatch.Key keyId : keys) {
|
||||
if (!me.equals(keyId.getParentKey()))
|
||||
if (!me.equals(keyId.getParentKey())) {
|
||||
throw new Failure(new NoSuchEntityException());
|
||||
}
|
||||
}
|
||||
|
||||
db.accountProjectWatches().deleteKeys(keys);
|
||||
|
@ -527,11 +527,13 @@ public class JettyServer {
|
||||
final ZipEntry ze = e.nextElement();
|
||||
final String name = ze.getName();
|
||||
|
||||
if (ze.isDirectory()) continue;
|
||||
if (name.startsWith("WEB-INF/")) continue;
|
||||
if (name.startsWith("META-INF/")) continue;
|
||||
if (name.startsWith("com/google/gerrit/launcher/")) continue;
|
||||
if (name.equals("Main.class")) continue;
|
||||
if (ze.isDirectory()
|
||||
|| name.startsWith("WEB-INF/")
|
||||
|| name.startsWith("META-INF/")
|
||||
|| name.startsWith("com/google/gerrit/launcher/")
|
||||
|| name.equals("Main.class")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final File rawtmp = new File(dstwar, name);
|
||||
mkdir(rawtmp.getParentFile());
|
||||
@ -561,8 +563,9 @@ public class JettyServer {
|
||||
private static void mkdir(File dir) throws IOException {
|
||||
if (!dir.isDirectory()) {
|
||||
mkdir(dir.getParentFile());
|
||||
if (!dir.mkdir())
|
||||
if (!dir.mkdir()) {
|
||||
throw new IOException("Cannot mkdir " + dir.getAbsolutePath());
|
||||
}
|
||||
dir.deleteOnExit();
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,9 @@ public class UpgradeFrom2_0_xTest extends InitTestCase {
|
||||
verify(ui);
|
||||
|
||||
for (String n : UpgradeFrom2_0_x.etcFiles) {
|
||||
if ("gerrit.config".equals(n)) continue;
|
||||
if ("secure.config".equals(n)) continue;
|
||||
if ("gerrit.config".equals(n) || "secure.config".equals(n)) {
|
||||
continue;
|
||||
}
|
||||
try (InputStream in = Files.newInputStream(site.etc_dir.resolve(n))) {
|
||||
assertEquals("# " + n + "\n",
|
||||
new String(ByteStreams.toByteArray(in), UTF_8));
|
||||
|
@ -68,8 +68,9 @@ public class EditList {
|
||||
|
||||
private int findCombinedEnd(final int i) {
|
||||
int end = i + 1;
|
||||
while (end < edits.size() && (combineA(end) || combineB(end)))
|
||||
while (end < edits.size() && (combineA(end) || combineB(end))) {
|
||||
end++;
|
||||
}
|
||||
return end - 1;
|
||||
}
|
||||
|
||||
|
@ -130,10 +130,11 @@ public class SparseFileContent {
|
||||
return size();
|
||||
}
|
||||
|
||||
if (idx < cur.base)
|
||||
if (idx < cur.base) {
|
||||
high = mid;
|
||||
else
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
} while (low < high);
|
||||
|
||||
return size();
|
||||
@ -183,10 +184,11 @@ public class SparseFileContent {
|
||||
currentRangeIdx = mid;
|
||||
return cur.get(idx);
|
||||
}
|
||||
if (idx < cur.base)
|
||||
if (idx < cur.base) {
|
||||
high = mid;
|
||||
else
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
} while (low < high);
|
||||
return null;
|
||||
}
|
||||
|
@ -79,9 +79,15 @@ public class AuditEvent {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AuditEvent other = (AuditEvent) obj;
|
||||
return this.uuid.equals(other.uuid);
|
||||
|
@ -39,8 +39,9 @@ public abstract class IntPredicate<T> extends OperatorPredicate<T> {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null)
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() == other.getClass()) {
|
||||
final IntPredicate<?> p = (IntPredicate<?>) other;
|
||||
return getOperator().equals(p.getOperator())
|
||||
|
@ -74,8 +74,9 @@ public class NotPredicate<T> extends Predicate<T> {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null)
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
return getClass() == other.getClass()
|
||||
&& getChildren().equals(((Predicate<?>) other).getChildren());
|
||||
}
|
||||
|
@ -50,8 +50,9 @@ public abstract class OperatorPredicate<T> extends Predicate<T> {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null)
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() == other.getClass()) {
|
||||
final OperatorPredicate<?> p = (OperatorPredicate<?>) other;
|
||||
return getOperator().equals(p.getOperator())
|
||||
|
@ -92,8 +92,9 @@ public class OrPredicate<T> extends Predicate<T> {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null)
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
return getClass() == other.getClass()
|
||||
&& getChildren().equals(((Predicate<?>) other).getChildren());
|
||||
}
|
||||
|
@ -81,8 +81,9 @@ public class VariablePredicate<T> extends Predicate<T> {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null)
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() == other.getClass()) {
|
||||
final VariablePredicate<?> v = (VariablePredicate<?>) other;
|
||||
return getName().equals(v.getName())
|
||||
|
@ -45,8 +45,9 @@ public final class WildPatternPredicate<T> extends OperatorPredicate<T> {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null)
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() == other.getClass()) {
|
||||
final WildPatternPredicate<?> p = (WildPatternPredicate<?>) other;
|
||||
return getOperator().equals(p.getOperator());
|
||||
|
@ -426,8 +426,9 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> project(String name) {
|
||||
if (name.startsWith("^"))
|
||||
if (name.startsWith("^")) {
|
||||
return new RegexProjectPredicate(name);
|
||||
}
|
||||
return new ProjectPredicate(name);
|
||||
}
|
||||
|
||||
@ -444,14 +445,16 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> branch(String name) {
|
||||
if (name.startsWith("^"))
|
||||
if (name.startsWith("^")) {
|
||||
return ref("^" + branchToRef(name.substring(1)));
|
||||
}
|
||||
return ref(branchToRef(name));
|
||||
}
|
||||
|
||||
private static String branchToRef(String name) {
|
||||
if (!name.startsWith(Branch.R_HEADS))
|
||||
if (!name.startsWith(Branch.R_HEADS)) {
|
||||
return Branch.R_HEADS + name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -462,15 +465,17 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> topic(String name) {
|
||||
if (name.startsWith("^"))
|
||||
if (name.startsWith("^")) {
|
||||
return new RegexTopicPredicate(name);
|
||||
}
|
||||
return new TopicPredicate(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> ref(String ref) {
|
||||
if (ref.startsWith("^"))
|
||||
if (ref.startsWith("^")) {
|
||||
return new RegexRefPredicate(ref);
|
||||
}
|
||||
return new RefPredicate(ref);
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,9 @@ public abstract class SchemaVersion {
|
||||
public static int guessVersion(Class<?> c) {
|
||||
String n = c.getName();
|
||||
n = n.substring(n.lastIndexOf('_') + 1);
|
||||
while (n.startsWith("0"))
|
||||
while (n.startsWith("0")) {
|
||||
n = n.substring(1);
|
||||
}
|
||||
return Integer.parseInt(n);
|
||||
}
|
||||
|
||||
|
@ -263,30 +263,33 @@ class CommandFactoryProvider implements Provider<CommandFactory>,
|
||||
switch (b) {
|
||||
case '\t':
|
||||
case ' ':
|
||||
if (inquote || inDblQuote)
|
||||
if (inquote || inDblQuote) {
|
||||
r.append(b);
|
||||
else if (r.length() > 0) {
|
||||
} else if (r.length() > 0) {
|
||||
list.add(r.toString());
|
||||
r = new StringBuilder();
|
||||
}
|
||||
continue;
|
||||
case '\"':
|
||||
if (inquote)
|
||||
if (inquote) {
|
||||
r.append(b);
|
||||
else
|
||||
} else {
|
||||
inDblQuote = !inDblQuote;
|
||||
}
|
||||
continue;
|
||||
case '\'':
|
||||
if (inDblQuote)
|
||||
if (inDblQuote) {
|
||||
r.append(b);
|
||||
else
|
||||
} else {
|
||||
inquote = !inquote;
|
||||
}
|
||||
continue;
|
||||
case '\\':
|
||||
if (inquote || ip == commandLine.length())
|
||||
if (inquote || ip == commandLine.length()) {
|
||||
r.append(b); // literal within a quote
|
||||
else
|
||||
} else {
|
||||
r.append(commandLine.charAt(ip++));
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
r.append(b);
|
||||
|
@ -88,10 +88,11 @@ final class DispatchCommand extends BaseCommand {
|
||||
checkRequiresCapability(cmd);
|
||||
if (cmd instanceof BaseCommand) {
|
||||
final BaseCommand bc = (BaseCommand) cmd;
|
||||
if (getName().isEmpty())
|
||||
if (getName().isEmpty()) {
|
||||
bc.setName(commandName);
|
||||
else
|
||||
} else {
|
||||
bc.setName(getName() + " " + commandName);
|
||||
}
|
||||
bc.setArguments(args.toArray(new String[args.size()]));
|
||||
|
||||
} else if (!args.isEmpty()) {
|
||||
|
@ -758,7 +758,9 @@ public class QueryShell {
|
||||
r.append(" (");
|
||||
boolean first = true;
|
||||
for (String c : columns.values()) {
|
||||
if (!first) r.append(", ");
|
||||
if (!first) {
|
||||
r.append(", ");
|
||||
}
|
||||
r.append(c);
|
||||
first = false;
|
||||
}
|
||||
|
@ -202,8 +202,9 @@ public class CmdLineParser {
|
||||
for (int argi = 0; argi < args.length; argi++) {
|
||||
final String str = args[argi];
|
||||
if (str.equals("--")) {
|
||||
while (argi < args.length)
|
||||
while (argi < args.length) {
|
||||
tmp.add(args[argi++]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user