Skip to content

Commit

Permalink
Merge pull request #334 from spyrkob/GAL-353_1.1
Browse files Browse the repository at this point in the history
[GAL-353] Sort hashes entries in .galleon/hashes folder
  • Loading branch information
jfdenise authored Oct 27, 2023
2 parents 3ceaef4 + bb9c833 commit b7b16f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/src/main/java/org/jboss/galleon/ProvisioningManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

import org.jboss.galleon.config.FeaturePackConfig;
import org.jboss.galleon.config.ProvisioningConfig;
Expand Down Expand Up @@ -870,7 +872,14 @@ private void persistChildHashes(Path hashes, FsEntry entry, List<FsEntry> dirs,
int dirsTotal = 0;
BufferedWriter writer = null;
try {
for (FsEntry child : entry.getChildren()) {
final TreeSet<FsEntry> sortedChildren = new TreeSet<>(new Comparator<FsEntry>() {
@Override
public int compare(FsEntry e1, FsEntry e2) {
return e1.getName().compareTo(e2.getName());
}
});
sortedChildren.addAll(entry.getChildren());
for (FsEntry child : sortedChildren) {
if (!child.isDir()) {
if (writer == null) {
writer = Files.newBufferedWriter(target.resolve(Constants.HASHES));
Expand Down

0 comments on commit b7b16f0

Please sign in to comment.