[
https://issues.apache.org/jira/browse/MINIFI-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15474714#comment-15474714
]
ASF GitHub Bot commented on MINIFI-104:
---------------------------------------
Github user apiri commented on a diff in the pull request:
https://github.com/apache/nifi-minifi/pull/32#discussion_r78068727
--- Diff:
minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/ConfigTransformer.java
---
@@ -546,6 +550,37 @@ protected static void addConnection(final Element
parentElement, ConnectionSchem
}
}
+ protected static String getConnectionName(ConnectionSchema
connectionProperties) {
+ String connectionName = connectionProperties.getName();
+ if (StringUtil.isNullOrEmpty(connectionName)) {
+ return EMPTY_NAME;
+ }
+ return connectionName;
+ }
+
+ /**
+ * Will replace all characters not in [A-Za-z0-9_] with _
+ *
+ * This has potential for collisions so it will also append numbers as
necessary to prevent that
+ *
+ * @param ids id map of already incremented numbers
+ * @param name the name
+ * @return a unique filesystem-friendly id
+ */
+ protected static String getUniqueId(Map<String, Integer> ids, String
name) {
+ String baseId = name.replaceAll("[^A-Za-z0-9_]", "_");
+ String id = baseId;
+ Integer idNum = ids.get(baseId);
+ while (ids.containsKey(id)) {
+ id = baseId + "_" + idNum++;
+ }
+ if (id != baseId) {
+ ids.put(baseId, idNum);
+ }
+ ids.put(id, 2);
--- End diff --
Ah, I see. Wasn't tracking and certainly didn't have that pop into mind.
> MiNiFi uses connection names for the FlowFileQueue.getIdentifier()
> ------------------------------------------------------------------
>
> Key: MINIFI-104
> URL: https://issues.apache.org/jira/browse/MINIFI-104
> Project: Apache NiFi MiNiFi
> Issue Type: Bug
> Reporter: Bryan Rosander
>
> This causes problems with the conversion tool and swapping. The forward
> slashes we put into the filename cause the FileSystemSwapManager to try to
> create a directory hierarchy for the swap file instead of just a file.
> One solution is to make sure it will be a legal filename and if necessary
> append unique numbers to it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)