[jdk8u-dev] RFR: 8309841: Jarsigner should print a warning if an entry is removed

Roman Marchenko rmarchenko at openjdk.org
Fri Mar 21 08:07:14 UTC 2025


On Fri, 21 Mar 2025 00:51:10 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:

>> This is backport of "8309841: Jarsigner should print a warning if an entry is removed"
>> 
>> Original patch does not apply cleanly to jdk8:
>> - some minor conflicts in JDK code
>> - files moved to appropriate locations
>> - added the check in `jdk/src/share/classes/sun/security/tools/jarsigner/Main.java` at line 1196
>> 
>> in tests:
>> - `ed25519` algorithm was replaced with `RSA` in `RemovedFiles.java`
>> - `JarEntry copyEntry()` procedure was manually added to `JarUtils.java` to make `JarUtilsTest` working.
>> - the tests were adapted to Java 8, including replaced `Path.of`, `Files.writeString`, package names, and arrays processing as well.
>> 
>> We need this fix in jdk8, as all versions have this issue with jarsigner.
>> 
>> New tests successfully ran locally on Linux, x86_64.
>
> Patch mostly looks good, but I think we should backport [JDK-8240235](https://bugs.openjdk.org/browse/JDK-8240235) first in its own PR. It is little more than the `copyEntry` method you've imported here, but also fixes other cases in `JarUtils.java` where it should also be used.
> 
> Also, should `java.nio.file.StandardCopyOption` be imported in `JarUtils.java`? I see the import being added but no reference to it added in the code.

@gnu-andrew 

> Patch mostly looks good, but I think we should backport [JDK-8240235](https://bugs.openjdk.org/browse/JDK-8240235) first in its own PR. 

Ok, if it's needed. I will do this.

> Also, should `java.nio.file.StandardCopyOption` be imported in `JarUtils.java`? I see the import being added but no reference to it added in the code.

There is the line 297:

Files.move(tmpfile, jarfile, StandardCopyOption.REPLACE_EXISTING);

-------------

PR Comment: https://git.openjdk.org/jdk8u-dev/pull/635#issuecomment-2742622143


More information about the jdk8u-dev mailing list