Github user brosander commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1371#discussion_r94170804
  
    --- Diff: 
nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java
 ---
    @@ -424,59 +419,104 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
             // because is the original flowfile is used for all matching 
rules. in this
             // case the order of the matching rules is preserved in the list
             final Map<FlowFile, List<Rule>> matchedRules = new HashMap<>();
    -        Map<String, String> statefulAttributes = null;
    +
    +        final Map<String, String> stateInitialAttributes;
    +        final Map<String, String> stateWorkingAttributes;
    +        StateMap stateMap = null;
     
             matchedRules.clear();
     
             try {
                 if (stateful) {
    -                statefulAttributes = new 
HashMap<>(context.getStateManager().getState(Scope.LOCAL).toMap());
    +                stateMap = context.getStateManager().getState(Scope.LOCAL);
    +                stateInitialAttributes = stateMap.toMap();
    +                stateWorkingAttributes = new  HashMap<>(stateMap.toMap());
                 } else {
    -                statefulAttributes = null;
    +                stateInitialAttributes = null;
    +                stateWorkingAttributes = null;
                 }
             } catch (IOException e) {
    -            logger.error("Failed to update attributes for {} due to 
failing to get state; transferring FlowFile back to '{}'", new 
Object[]{flowFile, Relationship.SELF.getName()}, e);
    -            session.transfer(flowFile);
    +            logger.error("Failed to get the initial state when processing 
{}; transferring FlowFile back to it's incoming queue", new 
Object[]{incomingFlowFile, Relationship.SELF.getName()}, e);
    --- End diff --
    
    also looks like you can remove the Relationship.SELF.getName() arg


---
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.
---

Reply via email to