From 4933f663b8b306eecefd393fe3d92b361f08e7ed Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 23 Apr 2021 00:58:47 +0200 Subject: [PATCH] Check for negative millisecond offset File.setLastModified() does not allow negative values, but those can be present in Date. One such source is ZipEntry.getTime(), which returns -1 to indicate a non-applicable time. Signed-off-by: Robert Varga --- .../org/codehaus/plexus/archiver/AbstractUnArchiver.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java b/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java index cc493c740..835763ce1 100644 --- a/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java +++ b/src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java @@ -373,7 +373,11 @@ else if ( isDirectory ) } } - targetFileName.setLastModified( entryDate.getTime() ); + final long millis = entryDate.getTime(); + if ( millis >= 0 ) + { + targetFileName.setLastModified( millis ); + } if ( !isIgnorePermissions() && mode != null && !isDirectory ) {