This is an automated email from the ASF dual-hosted git repository.
briansolo1985 pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/support/nifi-1.x by this push:
new 79b3083546 NIFI-12682 Fix MiNiFi agent manifest hash swaps
79b3083546 is described below
commit 79b3083546593268761300e33a670dc7f92d7747
Author: Ferenc Erdei <[email protected]>
AuthorDate: Mon Jan 29 13:35:53 2024 +0100
NIFI-12682 Fix MiNiFi agent manifest hash swaps
Signed-off-by: Ferenc Kis <[email protected]>
This closes #8309.
---
.../service/operation/SupportedOperationsProvider.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git
a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
index d60a9fee1a..591c02b1f1 100644
---
a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
+++
b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
@@ -17,7 +17,10 @@
package org.apache.nifi.c2.client.service.operation;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.nifi.c2.protocol.api.OperandType;
@@ -34,17 +37,26 @@ public class SupportedOperationsProvider {
public Set<SupportedOperation> getSupportedOperations() {
return operationHandlers.entrySet()
.stream()
+ .sorted(Map.Entry.comparingByKey())
.map(operationEntry ->
getSupportedOperation(operationEntry.getKey(), operationEntry.getValue()))
- .collect(Collectors.toSet());
+ .collect(Collectors.toCollection(LinkedHashSet::new));
}
private SupportedOperation getSupportedOperation(OperationType
operationType, Map<OperandType, C2OperationHandler> operands) {
SupportedOperation supportedOperation = new SupportedOperation();
supportedOperation.setType(operationType);
- Map<OperandType, Map<String, Object>> properties = operands.values()
+ Map<OperandType, Map<String, Object>> properties = operands.entrySet()
.stream()
- .collect(Collectors.toMap(C2OperationHandler::getOperandType,
C2OperationHandler::getProperties));
+ .sorted(Map.Entry.comparingByKey())
+ .map(Entry::getValue)
+ .collect(
+ Collectors.toMap(
+ C2OperationHandler::getOperandType,
+ C2OperationHandler::getProperties,
+ (existing, replacement) -> existing,
+ LinkedHashMap::new
+ ));
supportedOperation.setProperties(properties);