ReplicationQueue: Check nulls in firePendingEvents
After a sudden reboot (for unknown reason) Gerrit at startup couldn't
load because of NullPointerException. There is a possibility that
stored event was null at that point. Extra logging added to handle null
events.
Change-Id: I72f34d8def6e0246196cd865f33f6e795b21664b
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
index c79363b..da5a4d2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
@@ -170,8 +170,12 @@
private void firePendingEvents() {
for (EventsStorage.ReplicateRefUpdate e : eventsStorage.list()) {
- repLog.info("Firing pending event {}", e);
- onGitReferenceUpdated(e.project, e.ref);
+ if (e == null) {
+ repLog.warn("Encountered null replication event in EventsStorage");
+ } else {
+ repLog.info("Firing pending event {}", e);
+ onGitReferenceUpdated(e.project, e.ref);
+ }
}
}