@@ -55,7 +55,7 @@ public void setHistoryExtractionHandler(final HistoryExtractionHandler historyEx
55
55
* Run history extraction rules on all upstream events.
56
56
*
57
57
* @param aggregatedObjectId
58
- * the aggregated object id
58
+ * the aggregated object id
59
59
*/
60
60
public void runHistoryExtractionRulesOnAllUpstreamEvents (String aggregatedObjectId ) {
61
61
@@ -98,26 +98,29 @@ public void runHistoryExtractionRulesOnAllUpstreamEvents(String aggregatedObject
98
98
* </pre>
99
99
*
100
100
* @param jsonArray
101
- * the array to traverse
101
+ * the array to traverse
102
102
* @param aggregatedObjectId
103
- * the id of the aggregated object
103
+ * the id of the aggregated object
104
104
* @param pathInAggregatedObject
105
- * the current path in the aggregated object
105
+ * the current path in the aggregated object
106
106
*/
107
107
private void traverseTree (final JsonNode jsonArray , final String aggregatedObjectId ,
108
108
final String pathInAggregatedObject ) {
109
109
110
- final JsonNode parent = jsonArray .get (0 );
111
- JsonNode parentId = parent .at ("/meta/id" );
112
110
String np = pathInAggregatedObject ;
113
- if (!aggregatedObjectId .equals (parentId .textValue ())) {
114
- // parent event is not the same as the starting event so we can
115
- // start collecting history
116
- RulesObject rules = rulesHandler .getRulesForEvent (parent .toString ());
117
-
118
- np = historyExtractionHandler .runHistoryExtraction (aggregatedObjectId , rules , parent .toString (),
119
- pathInAggregatedObject );
111
+ final JsonNode parent = jsonArray .get (0 );
112
+ if (parent != null ) {
113
+ JsonNode parentId = parent .at ("/meta/id" );
114
+ if (!aggregatedObjectId .equals (parentId .textValue ())) {
115
+ // parent event is not the same as the starting event so we can
116
+ // start collecting history
117
+ RulesObject rules = rulesHandler .getRulesForEvent (parent .toString ());
118
+
119
+ np = historyExtractionHandler .runHistoryExtraction (aggregatedObjectId , rules , parent .toString (),
120
+ pathInAggregatedObject );
121
+ }
120
122
}
123
+
121
124
String prevNp = null ;
122
125
for (int i = 1 ; i < jsonArray .size (); i ++) {
123
126
if (jsonArray .get (i ).isObject ()) {
0 commit comments