commit | 0572b58bb75623d6402c3771fb83a982a313fe57 | [log] [tgz] |
---|---|---|
author | Emmanuel Debanne <e.debanne@criteo.com> | Mon Aug 31 14:43:43 2015 +0200 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Wed May 17 22:56:46 2017 +0100 |
tree | e40b42e8ffc0822abaf221089c714c966673dcd0 | |
parent | 894fcdec29680fe82ccf8a3a8287d9ed30d1912a [diff] |
Fix NullPointerException when evaluating draft reviews This change in Gerrit introduced a bug for draft reviews: https://gerrit-review.googlesource.com/#/c/67762/3/gerrit-server/src/main/java/com/google/gerrit/server/project/SubmitRuleEvaluator.java An NPE is thrown when the patchSet is not set before calling SubmitRuleEvaluator#evaluate(). This fix is a workaround until Gerrit is fixed. Change-Id: If531822421d501bd7970e03754d5ae5d8f3654ae
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java index c7e1cbd..a7db2c0 100644 --- a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java +++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
@@ -111,7 +111,7 @@ */ public boolean isSubmittable(String project, int change) throws OrmException { ChangeData changeData = changeDataFactory.create(db.get(), new Project.NameKey(project), new Change.Id(change)); - List<SubmitRecord> cansubmit = new SubmitRuleEvaluator(changeData).evaluate(); + List<SubmitRecord> cansubmit = new SubmitRuleEvaluator(changeData).setPatchSet(changeData.currentPatchSet()).evaluate(); log.debug(String.format("Checking if change %d is submitable.", change)); for (SubmitRecord submit : cansubmit) { if (submit.status != SubmitRecord.Status.OK) {