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