Merge branch 'stable-3.1'
* stable-3.1:
StartCommand/ListCommand: Use isEmpty() to test for empty collection
Make constants final
Change-Id: I2cf4561e60078013d7b6d32756fbd4c94084e1d2
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/GerritSshApi.java b/src/main/java/com/googlesource/gerrit/plugins/replication/GerritSshApi.java
index d37321a..d195aa3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/GerritSshApi.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/GerritSshApi.java
@@ -27,8 +27,8 @@
public class GerritSshApi implements AdminApi {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
- static int SSH_COMMAND_FAILED = -1;
- static String GERRIT_ADMIN_PROTOCOL_PREFIX = "gerrit+";
+ static final int SSH_COMMAND_FAILED = -1;
+ static final String GERRIT_ADMIN_PROTOCOL_PREFIX = "gerrit+";
protected final SshHelper sshHelper;
protected final URIish uri;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ListCommand.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ListCommand.java
index d337883..9264d9b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ListCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ListCommand.java
@@ -72,7 +72,7 @@
}
private void addQueueDetails(JsonObject obj, String key, Collection<PushOne> values) {
- if (values.size() > 0) {
+ if (!values.isEmpty()) {
JsonArray list = new JsonArray();
for (PushOne p : values) {
list.add(new JsonPrimitive(p.toString()));
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
index a557eb7..3f3c8e8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -111,7 +111,7 @@
}
}
- private static Gson GSON = new Gson();
+ private static final Gson GSON = new Gson();
private final Path refUpdates;
private final Path buildingUpdates;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/StartCommand.java b/src/main/java/com/googlesource/gerrit/plugins/replication/StartCommand.java
index 7115d5b..fa8b44c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/StartCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/StartCommand.java
@@ -55,7 +55,7 @@
@Override
protected void run() throws Failure {
- if (all && projectPatterns.size() > 0) {
+ if (all && !projectPatterns.isEmpty()) {
throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT");
}