fixup! Support exporting properties to task json

Fix a layering violation introduced when setting exported properties to
null when they are empty. This substitution is needed so that the json
field is not displayed on output which should only be of concern to the
TaskAttributeFactory and not to the Properties class. Move this null
setting to where the TaskAttribute is populated.

Change-Id: I39438932dc8ce44021e5aa91d1bec138608ade0a
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java b/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java
index 7c8ceb8..56bf23f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/Properties.java
@@ -58,13 +58,8 @@
     unexpanded.putAll(definition.exported);
     expandAllUnexpanded();
     definition.properties = expanded;
-
-    if (definition.exported.isEmpty()) {
-      definition.exported = null;
-    } else {
-      for (String property : definition.exported.keySet()) {
-        definition.exported.put(property, expanded.get(property));
-      }
+    for (String property : definition.exported.keySet()) {
+      definition.exported.put(property, expanded.get(property));
     }
 
     this.definition = definition;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
index 581e3a0..d7e733f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
@@ -153,7 +153,7 @@
                 attribute.inProgress = matchCache.matchOrNull(task.inProgress);
               }
               attribute.hint = getHint(attribute.status, task);
-              attribute.exported = task.exported;
+              attribute.exported = task.exported.isEmpty() ? null : task.exported;
 
               if (options.evaluationTime) {
                 attribute.evaluationMilliSeconds = millis() - attribute.evaluationMilliSeconds;