PropertyExtractor: Add null check for event.submitter
If the change was open, it would cause event.submitter to be
null. Fix this by adding a null check.
Gerrit's core does the same thing.
Bug: Issue 8051
Change-Id: I0690e184ba50ea1e60176e8be5af34c43a80393e
(cherry picked from commit d4659620aa109a9d9ea6641d18e9e473117cd22d)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
index 03bff09..b83f1c6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
@@ -116,7 +116,9 @@
private Map<String,Set<String>> extractFrom(RefUpdatedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.submitter.get(), "submitter"));
+ if (event.submitter != null) {
+ common.addAll(propertyAttributeExtractor.extractFrom(event.submitter.get(), "submitter"));
+ }
common.addAll(propertyAttributeExtractor.extractFrom(event.refUpdate.get()));
return issueExtractor.getIssueIds(event.getProjectNameKey().get(),
event.refUpdate.get().newRev);