This is an automated email from the ASF dual-hosted git repository.
alopresto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 5cb8d24 NIFI-7622 Use param context name from inside nested versioned
PG when importing
5cb8d24 is described below
commit 5cb8d246899df914781001415d0e155f90ef6ed3
Author: Bryan Bende <[email protected]>
AuthorDate: Fri Jul 10 14:30:20 2020 -0400
NIFI-7622 Use param context name from inside nested versioned PG when
importing
This closes #4401.
Signed-off-by: Andy LoPresto <[email protected]>
---
.../main/java/org/apache/nifi/groups/StandardProcessGroup.java | 9 ++++++++-
.../org/apache/nifi/registry/flow/RestBasedFlowRegistry.java | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
index d3b0c9e..99282c7 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
@@ -4211,7 +4211,7 @@ public final class StandardProcessGroup implements
ProcessGroup {
return childSnapshot.getParameterContexts();
} catch (final NiFiRegistryException e) {
throw new IllegalArgumentException("The Flow Registry with ID " +
registryId + " reports that no Flow exists with Bucket "
- + bucketId + ", Flow " + flowId + ", Version " +
flowVersion);
+ + bucketId + ", Flow " + flowId + ", Version " +
flowVersion, e);
} catch (final IOException ioe) {
throw new IllegalStateException(
"Failed to communicate with Flow Registry when attempting
to retrieve a versioned flow");
@@ -4273,6 +4273,13 @@ public final class StandardProcessGroup implements
ProcessGroup {
// Create a new Parameter Context based on the parameters
provided
final VersionedParameterContext versionedParameterContext =
versionedParameterContexts.get(proposedParameterContextName);
+ // Protect against NPE in the event somehow the proposed name
is not in the set of contexts
+ if (versionedParameterContext == null) {
+ final String paramContextNames =
StringUtils.join(versionedParameterContexts.keySet());
+ throw new IllegalStateException("Proposed parameter
context name '" + proposedParameterContextName
+ + "' does not exist in set of available parameter
contexts [" + paramContextNames + "]");
+ }
+
final ParameterContext contextByName =
getParameterContextByName(versionedParameterContext.getName());
final ParameterContext selectedParameterContext;
if (contextByName == null) {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/RestBasedFlowRegistry.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/RestBasedFlowRegistry.java
index dc5f28e..0adda02 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/RestBasedFlowRegistry.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/registry/flow/RestBasedFlowRegistry.java
@@ -258,6 +258,7 @@ public class RestBasedFlowRegistry implements FlowRegistry {
group.setProcessors(contents.getProcessors());
group.setRemoteProcessGroups(contents.getRemoteProcessGroups());
group.setVariables(contents.getVariables());
+ group.setParameterContextName(contents.getParameterContextName());
group.setFlowFileConcurrency(contents.getFlowFileConcurrency());
group.setFlowFileOutboundPolicy(contents.getFlowFileOutboundPolicy());
coordinates.setLatest(snapshot.isLatest());