From 04f694af41f22370f961952901147765aec4d989 Mon Sep 17 00:00:00 2001 From: Thomas Behr Date: Mon, 13 May 2024 10:09:40 +0200 Subject: [PATCH] fixed non-deterministic iteration order over input archives --- CHANGELOG.md | 9 +++++++-- gradle.properties | 2 +- .../yworks/util/abstractjar/impl/DirectoryWrapper.java | 4 ++-- .../com/yworks/util/abstractjar/impl/JarFileWrapper.java | 5 ++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d873dfa7..cab755fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.1.1] + +### Fixed +- Process files in the order they appear in the respective input archives or directories. + This fixes a regression that was introduced with directory support in version 3.0.0. + ## [4.1.0] ### Added @@ -77,8 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support `ASM7` and Java 13 in both YShrink and YGuard ### Fixed - -- Use a empty manifest in `JarWriter` where the shrinker would previously crash when no manifest was present +- Use an empty manifest in `JarWriter` where the shrinker would previously crash when no manifest was present - Use Gradle wrapper with Gradle version 5.6.4 for reproducible builds ## [2.9.2] - 2019-12-09 diff --git a/gradle.properties b/gradle.properties index 880f3f74..1d62b73b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ VERSION_MAJOR=4.1 -VERSION_MINOR=0 +VERSION_MINOR=1-SNAPSHOT POM_DESCRIPTION=The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts POM_URL=https://github.com/yWorks/yGuard diff --git a/src/main/java/com/yworks/util/abstractjar/impl/DirectoryWrapper.java b/src/main/java/com/yworks/util/abstractjar/impl/DirectoryWrapper.java index d68536b6..e552bba0 100644 --- a/src/main/java/com/yworks/util/abstractjar/impl/DirectoryWrapper.java +++ b/src/main/java/com/yworks/util/abstractjar/impl/DirectoryWrapper.java @@ -15,7 +15,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.Collections; import java.util.Enumeration; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.jar.JarFile; import java.util.jar.Manifest; @@ -25,7 +25,7 @@ */ public class DirectoryWrapper extends SimpleFileVisitor implements Archive { private File directory; - private Map entries = new HashMap<>(); + private Map entries = new LinkedHashMap<>(); /** * Instantiates a new Directory wrapper. diff --git a/src/main/java/com/yworks/util/abstractjar/impl/JarFileWrapper.java b/src/main/java/com/yworks/util/abstractjar/impl/JarFileWrapper.java index 44a8e87d..19e94011 100644 --- a/src/main/java/com/yworks/util/abstractjar/impl/JarFileWrapper.java +++ b/src/main/java/com/yworks/util/abstractjar/impl/JarFileWrapper.java @@ -8,7 +8,7 @@ import java.io.InputStream; import java.util.Collections; import java.util.Enumeration; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -25,7 +25,7 @@ public class JarFileWrapper implements Archive { /** * The Entries. */ - Map entries = new HashMap<>(); + Map entries = new LinkedHashMap<>(); /** * Instantiates a new Jar file wrapper. @@ -66,5 +66,4 @@ public InputStream getInputStream( final Entry entry ) throws IOException { public void close() throws IOException { jarFile.close(); } - }