Adapt to CurrentUser#getUserName changes
[1] modifies CurrentUser#getUserName to return Optional<String>
instead of nullable String.
This fixes having Optional[user_name] in the download_ref name.
[1] https://gerrit-review.googlesource.com/c/gerrit/+/153310
Change-Id: Ic99f69b293b273a65b911fa4b19d4399172c473f
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchCloser.java b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchCloser.java
index 5f68d7c..a528d2f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchCloser.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchCloser.java
@@ -56,9 +56,9 @@
protected String getBatchRef(Batch batch, Batch.Destination dest) {
// AccountId is always present, UserName is optional but the preferred identifier
- if (user.getUserName() != null) {
+ if (user.getUserName().isPresent()) {
return String.format(
- "refs/batch/%s/%s/%s/%s", "users", user.getUserName(), batch.id, dest.ref);
+ "refs/batch/%s/%s/%s/%s", "users", user.getUserName().get(), batch.id, dest.ref);
}
return String.format(
"refs/batch/%s/%s/%s/%s",