gnodet commented on code in PR #401:
URL: https://github.com/apache/maven-archiver/pull/401#discussion_r4108689675
##########
src/main/java/org/apache/maven/shared/archiver/MavenArchiver.java:
##########
@@ -69,8 +71,18 @@
*/
public class MavenArchiver {
+ private static final Logger LOGGER =
LoggerFactory.getLogger(MavenArchiver.class);
+
private static final String CREATED_BY = "Maven Archiver";
+ /**
+ * Minimum timestamp value for ZIP/JAR entries (1980-01-01T00:00:02Z).
+ * Timestamps before this value are clamped to it with a warning.
+ *
+ * @since 3.7.1
Review Comment:
Fixed in 18dfc78.
##########
src/main/java/org/apache/maven/shared/archiver/MavenArchiver.java:
##########
@@ -701,16 +713,32 @@ public static Optional<Instant>
parseBuildOutputTimestamp(String outputTimestamp
// Number representing seconds since the epoch
if (isNumeric(outputTimestamp)) {
- final Instant date =
Instant.ofEpochSecond(Long.parseLong(outputTimestamp));
+ Instant date =
Instant.ofEpochSecond(Long.parseLong(outputTimestamp));
+ if (date.isBefore(DATE_MIN)) {
+ LOGGER.warn(
+ "Timestamp '{}' is before the minimum date for ZIP/JAR
entries."
+ + " Clamping to DATE_MIN ({}). See
https://github.com/apache/maven-jar-plugin/issues/595",
+ date,
+ DATE_MIN);
+ date = DATE_MIN;
+ }
Review Comment:
Fixed in 18dfc78. Extracted `clampToDateMin(Instant, String)` helper — also
includes the original input string in the warning message now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]