|
20 | 20 | import com.ericsson.ei.rules.RulesObject;
|
21 | 21 | import com.fasterxml.jackson.databind.JsonNode;
|
22 | 22 | import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
| 23 | +import com.fasterxml.jackson.databind.node.NullNode; |
23 | 24 | import com.github.wnameless.json.flattener.JsonFlattener;
|
24 | 25 |
|
25 | 26 | import org.slf4j.Logger;
|
@@ -58,11 +59,13 @@ public class HistoryExtractionHandler {
|
58 | 59 | public String runHistoryExtraction(String aggregatedObjectId, RulesObject rules, String event,
|
59 | 60 | String pathInAggregatedObject) {
|
60 | 61 | JsonNode objectToMerge = extractContent(rules, event);
|
61 |
| - if (objectToMerge == null) { |
| 62 | + if (objectToMerge instanceof NullNode) { |
62 | 63 | return pathInAggregatedObject;
|
63 | 64 | }
|
64 | 65 |
|
65 | 66 | JsonNode ruleJson = getHistoryPathRule(rules, event);
|
| 67 | + if (ruleJson instanceof NullNode) |
| 68 | + return pathInAggregatedObject; |
66 | 69 | String ruleString = ruleJson.toString();
|
67 | 70 |
|
68 | 71 | // if we need to add append to an array then array_path will not be
|
@@ -155,7 +158,7 @@ private JsonNode getHistoryPathRule(RulesObject rulesObject, String event) {
|
155 | 158 | if (rule != null)
|
156 | 159 | return jmesPathInterface.runRuleOnEvent(rule, event);
|
157 | 160 |
|
158 |
| - return JsonNodeFactory.instance.objectNode(); |
| 161 | + return JsonNodeFactory.instance.nullNode(); |
159 | 162 | }
|
160 | 163 |
|
161 | 164 | }
|
0 commit comments