Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
Avoid throwing exception due to deleted change
Change-Id: I87fc07bd38aa07a02609d5d24afa101366f42406
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/PushResultProcessing.java b/src/main/java/com/googlesource/gerrit/plugins/replication/PushResultProcessing.java
index bc503ac..fd4cebf 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushResultProcessing.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushResultProcessing.java
@@ -179,7 +179,10 @@
try {
ReviewDb db = schema.open();
try {
- hooks.postEvent(retrieveChange(ref, db), event, db);
+ Change change = retrieveChange(ref, db);
+ if (change != null) {
+ hooks.postEvent(change, event, db);
+ }
} finally {
db.close();
}
@@ -196,9 +199,6 @@
throws OrmException, NoSuchChangeException {
PatchSet.Id id = PatchSet.Id.fromRef(ref);
Change change = db.changes().get(id.getParentKey());
- if (change == null) {
- throw new NoSuchChangeException(id.getParentKey());
- }
return change;
}
}