Repository: nifi Updated Branches: refs/heads/master e5322b5d3 -> 2fb213d26
NIFI-5145 Fixed evaluateAttributeExpressions in mockpropertyvalue to make it handle null flowfiles. Signed-off-by: Matthew Burgess <mattyb...@apache.org> This closes #2749 Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/2fb213d2 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/2fb213d2 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/2fb213d2 Branch: refs/heads/master Commit: 2fb213d26c554445c7df0c4b6e5c669200b831e3 Parents: e5322b5 Author: Mike Thomsen <mikerthom...@gmail.com> Authored: Thu May 31 19:39:05 2018 -0400 Committer: Matthew Burgess <mattyb...@apache.org> Committed: Mon Jun 18 09:14:25 2018 -0400 ---------------------------------------------------------------------- .../main/java/org/apache/nifi/util/MockPropertyValue.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/2fb213d2/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java ---------------------------------------------------------------------- diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java index a5df1a9..6e38a08 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockPropertyValue.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.util; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -208,9 +209,13 @@ public class MockPropertyValue implements PropertyValue { * is running, it doesn't care when it's evaluating EL against a null flowfile. However, the testing framework currently * raises an error which makes it not mimick real world behavior. */ - if (flowFile == null) { - return evaluateAttributeExpressions(null, (Map<String,String>)null); + if (flowFile == null && expressionLanguageScope == ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) { + return evaluateAttributeExpressions(new HashMap<>()); + } else if (flowFile == null && expressionLanguageScope == ExpressionLanguageScope.VARIABLE_REGISTRY) { + return evaluateAttributeExpressions(); //Added this to get around a similar edge case where the a null flowfile is passed + //and the scope is to the registry } + return evaluateAttributeExpressions(flowFile, null, null); }