summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Miller <marco.miller@ericsson.com>2019-05-27 14:23:49 -0400
committerNguyen Tuan Khang Phan <nguyen.tuan.khang.phan@ericsson.com>2020-02-21 21:07:16 +0000
commit1850413298125a857b61d31510ccb22c0dfafc1e (patch)
tree773f307ef545258cf03e20ca29153a045a0c34a2
parent9b36785011a8f0891bf1fad68a9a83f2b26ba00b (diff)
ReplicationQueue: Check nulls in firePendingEventsv2.15.22v2.15.19upstream/stable-2.15
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
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java8
1 files changed, 6 insertions, 2 deletions
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 @@ public class ReplicationQueue
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);
+ }
}
}