Skip to content

Commit d0f4a97

Browse files
committed
[GAL-371] Keep properties and parameters in provisioned.xml ordered alphabetically
1 parent 8de9f8c commit d0f4a97

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

core/src/main/java/org/jboss/galleon/xml/ConfigXmlWriter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 Red Hat, Inc. and/or its affiliates
2+
* Copyright 2016-2025 Red Hat, Inc. and/or its affiliates
33
* and other contributors as indicated by the @author tags.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +17,8 @@
1717
package org.jboss.galleon.xml;
1818

1919
import java.util.Map;
20+
import java.util.TreeMap;
21+
2022
import org.jboss.galleon.config.ConfigId;
2123

2224
import org.jboss.galleon.config.ConfigModel;
@@ -51,7 +53,7 @@ protected ElementNode toElement(ConfigModel config, String ns) {
5153

5254
if(config.hasProperties()) {
5355
final ElementNode propsE = addElement(configE, Element.PROPS.getLocalName(), ns);
54-
for(Map.Entry<String, String> prop : config.getProperties().entrySet()) {
56+
for(Map.Entry<String, String> prop : new TreeMap<>(config.getProperties()).entrySet()) {
5557
final ElementNode propE = addElement(propsE, Element.PROP.getLocalName(), ns);
5658
addAttribute(propE, Attribute.NAME, prop.getKey());
5759
addAttribute(propE, Attribute.VALUE, prop.getValue());

core/src/main/java/org/jboss/galleon/xml/ProvisionedConfigXmlWriter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 Red Hat, Inc. and/or its affiliates
2+
* Copyright 2016-2025 Red Hat, Inc. and/or its affiliates
33
* and other contributors as indicated by the @author tags.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +17,8 @@
1717
package org.jboss.galleon.xml;
1818

1919
import java.util.Map;
20+
import java.util.TreeMap;
21+
import java.util.TreeSet;
2022

2123
import javax.xml.stream.XMLStreamException;
2224

@@ -66,7 +68,7 @@ public void nextFeature(ProvisionedFeature feature) throws ProvisioningException
6668
addAttribute(featureE, Attribute.ID, feature.getId().toString());
6769
}
6870
if(feature.hasParams()) {
69-
for(String param : feature.getParamNames()) {
71+
for(String param : new TreeSet<>(feature.getParamNames())) {
7072
final ElementNode paramE = addElement(featureE, Element.PARAM.getLocalName(), parent.getNamespace());
7173
addAttribute(paramE, Attribute.NAME, param);
7274
addAttribute(paramE, Attribute.VALUE, feature.getConfigParam(param));
@@ -100,7 +102,7 @@ protected ElementNode toElement(ProvisionedConfig config, String ns) throws XMLS
100102

101103
if(config.hasProperties()) {
102104
final ElementNode propsE = addElement(configE, Element.PROPS.getLocalName(), ns);
103-
for(Map.Entry<String, String> entry : config.getProperties().entrySet()) {
105+
for(Map.Entry<String, String> entry : new TreeMap<>(config.getProperties()).entrySet()) {
104106
final ElementNode propE = addElement(propsE, Element.PROP.getLocalName(), ns);
105107
addAttribute(propE, Attribute.NAME, entry.getKey());
106108
addAttribute(propE, Attribute.VALUE, entry.getValue());

0 commit comments

Comments
 (0)