NIFI-496: Only update the updatedAttributes map if a value is changed
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/e8fde859 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/e8fde859 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/e8fde859 Branch: refs/heads/NIFI-271 Commit: e8fde859141e55fd13a1eaae77f4705e61f6071d Parents: abd279c Author: Mark Payne <marka...@hotmail.com> Authored: Thu Apr 9 09:31:20 2015 -0400 Committer: Mark Payne <marka...@hotmail.com> Committed: Thu Apr 9 09:31:20 2015 -0400 ---------------------------------------------------------------------- .../repository/StandardRepositoryRecord.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e8fde859/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardRepositoryRecord.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardRepositoryRecord.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardRepositoryRecord.java index 1fde9aa..6ecb991 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardRepositoryRecord.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/StandardRepositoryRecord.java @@ -116,12 +116,23 @@ public class StandardRepositoryRecord implements RepositoryRecord { public void setWorking(final FlowFileRecord flowFile, final String attributeKey, final String attributeValue) { workingFlowFileRecord = flowFile; - updatedAttributes.put(attributeKey, attributeValue); + + // If setting attribute to same value as original, don't add to updated attributes + final String currentValue = originalAttributes.get(attributeKey); + if ( currentValue == null || !currentValue.equals(attributeValue) ) { + updatedAttributes.put(attributeKey, attributeValue); + } } public void setWorking(final FlowFileRecord flowFile, final Map<String, String> updatedAttribs) { workingFlowFileRecord = flowFile; - updatedAttributes.putAll(updatedAttribs); + + for ( final Map.Entry<String, String> entry : updatedAttribs.entrySet() ) { + final String currentValue = originalAttributes.get(entry.getKey()); + if ( currentValue == null || !currentValue.equals(entry.getValue()) ) { + updatedAttributes.put(entry.getKey(), entry.getValue()); + } + } } @Override