Change API calls to change.currentRevision instead use raw string.
This is so that if change.currentRevision is null, we don't get an NPE.
Change-Id: I37d517b35355fda8e237ea549b2ad9b33eddd3f5
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java
index f56d464..6854143 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreator.java
@@ -79,6 +79,7 @@
private static final String MERGE_CONFLICT_TAG = "autogenerated:MergeConflict";
private static final String SUBJECT_PREFIX = "automerger";
private static final String SKIPPED_PREFIX = "skipped";
+ private static final String CURRENT = "current";
protected GerritApi gApi;
protected ConfigLoader config;
@@ -155,7 +156,7 @@
"Automerger prevented the topic from changing. Topic can only be modified on "
+ "non-automerger-created CLs to a non-empty value.");
reviewInput.notify = NotifyHandling.NONE;
- gApi.changes().id(change._number).revision(change.currentRevision).review(reviewInput);
+ gApi.changes().id(change._number).revision(CURRENT).review(reviewInput);
} catch (RestApiException e) {
log.error("Failed to prevent setting empty topic for automerger plugin.", e);
}
@@ -336,13 +337,13 @@
try {
gApi.changes()
.id(mdsMergeInput.changeNumber)
- .revision(mdsMergeInput.currentRevision)
+ .revision(CURRENT)
.review(reviewInput);
} catch (AuthException e) {
reviewInput.labels = null;
gApi.changes()
.id(mdsMergeInput.changeNumber)
- .revision(mdsMergeInput.currentRevision)
+ .revision(CURRENT)
.review(reviewInput);
}
}
@@ -654,7 +655,7 @@
reviewInput.notify = NotifyHandling.NONE;
reviewInput.tag = AUTOMERGER_TAG;
try {
- gApi.changes().id(change.id).revision(change.currentRevision).review(reviewInput);
+ gApi.changes().id(change.id).revision(CURRENT).review(reviewInput);
} catch (AuthException e) {
log.error("Automerger could not set label, but still continuing.", e);
}