nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joew...@apache.org
Subject nifi git commit: NIFI-3768: This closes #1727. Avoid wrapping FlowFile Attributes Map in an UnmodifiableMap in the StandardFlowFileBuilder
Date Tue, 02 May 2017 04:18:03 GMT
Repository: nifi
Updated Branches:
  refs/heads/master 07989b846 -> b96e402e7


NIFI-3768: This closes #1727. Avoid wrapping FlowFile Attributes Map in an UnmodifiableMap
in the StandardFlowFileBuilder

Signed-off-by: joewitt <joewitt@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/b96e402e
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/b96e402e
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/b96e402e

Branch: refs/heads/master
Commit: b96e402e78caca0dae58b7def37992cb56ee246e
Parents: 07989b8
Author: Mark Payne <markap14@hotmail.com>
Authored: Mon May 1 22:48:48 2017 -0400
Committer: joewitt <joewitt@apache.org>
Committed: Mon May 1 22:51:05 2017 -0400

----------------------------------------------------------------------
 .../nifi/controller/repository/StandardFlowFileRecord.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/b96e402e/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-repository-models/src/main/java/org/apache/nifi/controller/repository/StandardFlowFileRecord.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-repository-models/src/main/java/org/apache/nifi/controller/repository/StandardFlowFileRecord.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-repository-models/src/main/java/org/apache/nifi/controller/repository/StandardFlowFileRecord.java
index a1d5173..fd098eb 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-repository-models/src/main/java/org/apache/nifi/controller/repository/StandardFlowFileRecord.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-repository-models/src/main/java/org/apache/nifi/controller/repository/StandardFlowFileRecord.java
@@ -319,7 +319,12 @@ public final class StandardFlowFileRecord implements FlowFile, FlowFileRecord
{
             bLineageIdentifiers.clear();
             bPenaltyExpirationMs = specFlowFile.getPenaltyExpirationMillis();
             bSize = specFlowFile.getSize();
-            bAttributes = specFlowFile.getAttributes();
+            // If this is a StandardFlowFileRecord, access the attributes map directly. Do
not use the
+            // getAttributes() method, because that will wrap the original in an UnmodifiableMap.
As a result,
+            // a Processor that continually calls session.append() for instance will have
a FlowFile whose attributes
+            // Map is wrapped thousands of times until it hits a StackOverflowError. We want
the getter to return
+            // UnmodifiableMap, though, so that Processors cannot directly modify that Map.
+            bAttributes = specFlowFile instanceof StandardFlowFileRecord ? ((StandardFlowFileRecord)
specFlowFile).attributes : specFlowFile.getAttributes();
             bAttributesCopied = false;
             bClaim = specFlowFile.getContentClaim();
             bClaimOffset = specFlowFile.getContentClaimOffset();


Mime
View raw message