RFR: 8276766: Enable jar and jmod to produce deterministic timestamped content [v4]

Lance Andersen lancea at openjdk.java.net
Fri Nov 26 16:29:07 UTC 2021


On Thu, 25 Nov 2021 17:57:20 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

>> test/jdk/tools/jar/JarEntryTime.java line 129:
>> 
>>> 127:         // Make a jar file from that directory structure with
>>> 128:         // --source-date set to epoch seconds 1647302400 (15/03/2022)
>>> 129:         long sourceDate = 1647302400L;
>> 
>> Please consider  adding a few before Epoch test values.
>
> @LanceAndersen java File times can't be before the epoch, but having a test before dostime 1980 would be useful

> 

The change to sun/tools/jar/GNUStyleOptions.java does not prevent a negative value which can be set via ZipEntry similar to:

    public void testOfEpochSecond() {
        var ze = new ZipEntry("test");
        for(var i =  0; i < 100; i++) {
            var time = LocalDateTime.ofEpochSecond(-i, 0, ZoneOffset.UTC);
            ze.setTimeLocal(time);
            System.out.printf(
                    "time= %s, Zip Entry time= %s%n", time, ze.getTimeLocal());
        }
    }

If the intent is to not support dates prior to the Epoch then GNUStyleOptions should throw an Exception in this case.

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

PR: https://git.openjdk.java.net/jdk/pull/6481


More information about the compiler-dev mailing list