Skip to content

Commit

Permalink
SLING-12220 : Ensure that metadata properties are always written in t…
Browse files Browse the repository at this point in the history
…he same order
  • Loading branch information
cziegeler committed Jan 4, 2024
1 parent dc8278e commit b1cb1f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/apache/sling/feature/Artifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -60,7 +60,7 @@ public class Artifact implements Comparable<Artifact>, Serializable {
private final ArtifactId id;

/** Artifact metadata. */
private final Map<String,String> metadata = new HashMap<>();
private final Map<String,String> metadata = new TreeMap<>();

/**
* Construct a new artifact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static void mergeArtifacts(final Artifacts target,
int insertPos = target.size();
int count = 0;
for (final Artifact existing : allExistingInTarget) {
if (sourceFeature.getId().toMvnId().equals(existing.getMetadata().get(originKey))) {
if (originKey != null && sourceFeature.getId().toMvnId().equals(existing.getMetadata().get(originKey))) {
// If the source artifact came from the same feature, keep them side-by-side
// but make sure we add the target ones first - hence, the count
selectedArtifacts.add(count++, existing);
Expand Down

0 comments on commit b1cb1f4

Please sign in to comment.