Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8276766: Enable jar and jmod to produce deterministic timestamped content #6481

Closed
Closed
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6f2b7eb
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 19, 2021
579fe77
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 19, 2021
dec457f
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 23, 2021
f4694dc
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 23, 2021
6d37243
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 23, 2021
3768810
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 29, 2021
7f24db7
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 29, 2021
4deb80e
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 29, 2021
c7928bf
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 29, 2021
68235d0
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 29, 2021
6206c1e
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 29, 2021
a2aabe8
Merge branch 'master' of https://github.com/openjdk/jdk into jarjmodt…
andrew-m-leonard Nov 30, 2021
ab53ea6
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 30, 2021
06aadf1
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 30, 2021
62e2f7c
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 30, 2021
283e435
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Nov 30, 2021
a21806f
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 1, 2021
c84bc5a
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 1, 2021
2f3a7fc
Update src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java
andrew-m-leonard Dec 1, 2021
4636b07
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 2, 2021
18044d3
Merge branch 'master' of https://github.com/openjdk/jdk into jarjmodt…
andrew-m-leonard Dec 2, 2021
c994aea
Merge branch 'jarjmodtimestamps' of github.com:andrew-m-leonard/jdk i…
andrew-m-leonard Dec 2, 2021
8e60bb7
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 2, 2021
290a490
Merge branch 'master' of https://github.com/openjdk/jdk into jarjmodt…
andrew-m-leonard Dec 2, 2021
0686369
Merge jdk:master
andrew-m-leonard Dec 3, 2021
2a2d781
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 6, 2021
c510430
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 6, 2021
5961735
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 6, 2021
436762f
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 9, 2021
0add0d3
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 10, 2021
82e740e
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 10, 2021
0a69d01
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 10, 2021
f99fc41
8276766: Enable jar and jmod to produce deterministic timestamped con…
andrew-m-leonard Dec 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions src/java.base/share/classes/java/util/zip/ZipUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -149,33 +149,16 @@ private static long javaToDosTime(LocalDateTime ldt) {
* @return DOS time with 2s remainder encoded into upper half
*/
static long javaToExtendedDosTime(long time) {
return javaToExtendedDosTime(time, null);
}

static LocalDateTime javaEpochToLocalDateTime(long time) {
return javaEpochToLocalDateTime(time, null);
}

/**
* Converts Java time to DOS time using specified time-zone,
* encoding any milliseconds lost in the conversion into the
* upper half of the returned long.
*
* @param time milliseconds since epoch
* @param zoneId time-zone to convert from UTC value into local time.
* @return DOS time with 2s remainder encoded into upper half
*/
static long javaToExtendedDosTime(long time, ZoneId zoneId) {
LocalDateTime ldt = javaEpochToLocalDateTime(time, zoneId);
LocalDateTime ldt = javaEpochToLocalDateTime(time);
if (ldt.getYear() >= 1980) {
return javaToDosTime(ldt) + ((time % 2000) << 32);
}
return ZipEntry.DOSTIME_BEFORE_1980;
}

static LocalDateTime javaEpochToLocalDateTime(long time, ZoneId zoneId) {
static LocalDateTime javaEpochToLocalDateTime(long time) {
Instant instant = Instant.ofEpochMilli(time);
return LocalDateTime.ofInstant(instant, zoneId == null ? ZoneId.systemDefault() : zoneId);
return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
}

/**