[
https://issues.apache.org/jira/browse/NIFI-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380040#comment-15380040
]
ASF GitHub Bot commented on NIFI-826:
-------------------------------------
Github user mcgilman commented on a diff in the pull request:
https://github.com/apache/nifi/pull/617#discussion_r71035162
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java
---
@@ -168,7 +172,13 @@ public Response exportTemplate(
}
// generate the response
- return generateOkResponse(template).header("Content-Disposition",
String.format("attachment; filename=\"%s.xml\"", attachmentName)).build();
+ /*
+ * Here instead of relying on default JAXB marshalling we are
simply
+ * serializing template to String (formatted, indented etc) and
sending
+ * it as part of the response.
+ */
+ String serializedTemplate = new
String(TemplateSerializer.serialize(template), StandardCharsets.UTF_8);
--- End diff --
This is fine here but we could have stream the template instead of
converting to a String in memory using an approach like [1]
[1]
https://github.com/apache/nifi/blob/5cd5a4ce788bec39e0dc5c7db93356610a9fa84e/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceEventResource.java#L146
> Export templates in a deterministic way
> ---------------------------------------
>
> Key: NIFI-826
> URL: https://issues.apache.org/jira/browse/NIFI-826
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Core Framework
> Reporter: Matt Gilman
> Assignee: Oleg Zhurakousky
> Fix For: 1.0.0
>
>
> Templates should be exported in a deterministic way so that they can be
> compared or diff'ed with another. Items to consider...
> - The ordering of components
> - The id's used to identify the components
> - Consider excluding irrelevant items. When components are imported some
> settings are ignored (run state).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)