Skip to content

Commit 42b9862

Browse files
committed
NIFI-14861: Fixed bug in dynamic properties processing
1 parent df52f88 commit 42b9862

File tree

1 file changed

+6
-2
lines changed
  • nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph

1 file changed

+6
-2
lines changed

nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/EnrichGraphRecord.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,13 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
262262
Map<String, Object> dynamicPropertyMap = new HashMap<>();
263263
for (String entry : dynamic.keySet()) {
264264
if (!dynamicPropertyMap.containsKey(entry)) {
265-
final Object propertyValue = getRecordValue(record, dynamic.get(entry));
265+
final List<FieldValue> propertyValues = getRecordValue(record, dynamic.get(entry));
266+
// Use the first value if multiple are found
267+
if (propertyValues == null || propertyValues.isEmpty() || propertyValues.get(0).getValue() == null) {
268+
throw new IOException("Dynamic property field(s) not found in record (check the RecordPath Expression), sending this record to failure");
269+
}
266270

267-
dynamicPropertyMap.put(entry, propertyValue);
271+
dynamicPropertyMap.put(entry, propertyValues.get(0).getValue());
268272
}
269273
}
270274

0 commit comments

Comments
 (0)