Github user olegz commented on a diff in the pull request:
https://github.com/apache/nifi/pull/319#discussion_r59996122
--- Diff:
nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java
---
@@ -489,17 +546,32 @@ private FlowFile executeActions(final ProcessSession
session, final ProcessConte
final Map<String, String> attributesToUpdate = new
HashMap<>(actions.size());
final Set<String> attributesToDelete = new
HashSet<>(actions.size());
+ final Map<String, String> statefulAttributesToSet;
+
+ if (statefulAttributes != null){
+ statefulAttributesToSet = new HashMap<>();
+ } else {
+ statefulAttributesToSet = null;
+ }
+
+
// go through each action
for (final Action action : actions.values()) {
if
(!action.getAttribute().equals(DELETE_ATTRIBUTES.getName())) {
try {
- final String newAttributeValue =
getPropertyValue(action.getValue(),
context).evaluateAttributeExpressions(flowfile).getValue();
+ final String newAttributeValue =
getPropertyValue(action.getValue(),
context).evaluateAttributeExpressions(flowfile, statefulAttributes).getValue();
// log if appropriate
if (logger.isDebugEnabled()) {
logger.debug(String.format("%s setting attribute
'%s' = '%s' for %s per rule '%s'.", this, action.getAttribute(),
newAttributeValue, flowfile, ruleName));
}
+ if (statefulAttributesToSet != null) {
+
if(!action.getAttribute().equals("UpdateAttribute.matchedRule")) {
--- End diff --
Same comment as above on NPE
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---