@@ -465,7 +465,7 @@ protected void zipFile( InputStreamSupplier in, ConcurrentJarCreator zOut, Strin
465
465
if ( !skipWriting )
466
466
{
467
467
ZipArchiveEntry ze = new ZipArchiveEntry ( vPath );
468
- setTime ( ze , lastModified );
468
+ setZipEntryTime ( ze , lastModified );
469
469
470
470
ze .setMethod ( doCompress ? ZipArchiveEntry .DEFLATED : ZipArchiveEntry .STORED );
471
471
ze .setUnixMode ( UnixStat .FILE_FLAG | mode );
@@ -528,35 +528,26 @@ protected void zipFile( final ArchiveEntry entry, ConcurrentJarCreator zOut, Str
528
528
}
529
529
}
530
530
531
- protected void setTime ( ZipArchiveEntry zipEntry , long lastModified )
531
+ /**
532
+ * Set the ZipEntry dostime using the date if specified otherwise the original time.
533
+ *
534
+ * <p>Zip archives store file modification times with a granularity of two seconds, so the times will either be
535
+ * rounded up or down. If you round down, the archive will always seem out-of-date when you rerun the task, so the
536
+ * default is to round up. Rounding up may lead to a different type of problems like JSPs inside a web archive that
537
+ * seem to be slightly more recent than precompiled pages, rendering precompilation useless.
538
+ * plexus-archiver chooses to round up.
539
+ *
540
+ * @param zipEntry to set the last modified time
541
+ * @param lastModifiedTime to set in the zip entry only if {@link #getLastModifiedTime()} returns null
542
+ */
543
+ protected void setZipEntryTime ( ZipArchiveEntry zipEntry , long lastModifiedTime )
532
544
{
533
545
if ( getLastModifiedTime () != null )
534
546
{
535
- lastModified = getLastModifiedTime ().toMillis ();
547
+ lastModifiedTime = getLastModifiedTime ().toMillis ();
536
548
}
537
549
538
- // Zip archives store file modification times with a
539
- // granularity of two seconds, so the times will either be rounded
540
- // up or down. If you round down, the archive will always seem
541
- // out-of-date when you rerun the task, so the default is to round
542
- // up. Rounding up may lead to a different type of problems like
543
- // JSPs inside a web archive that seem to be slightly more recent
544
- // than precompiled pages, rendering precompilation useless.
545
- // plexus-archiver chooses to round up.
546
- zipEntry .setTime ( lastModified + 1999 );
547
-
548
- /* Consider adding extended file stamp support.....
549
-
550
- X5455_ExtendedTimestamp ts = new X5455_ExtendedTimestamp();
551
- ts.setModifyJavaTime(new Date(lastModified));
552
- if (zipEntry.getExtra() != null){
553
- // Uh-oh. What do we do now.
554
- throw new IllegalStateException("DIdnt expect to see xtradata here ?");
555
-
556
- } else {
557
- zipEntry.setExtra(ts.getLocalFileDataData());
558
- }
559
- */
550
+ zipEntry .setTime ( lastModifiedTime + 1999 );
560
551
}
561
552
562
553
protected void zipDir ( PlexusIoResource dir , ConcurrentJarCreator zOut , String vPath , int mode ,
@@ -595,12 +586,12 @@ protected void zipDir( PlexusIoResource dir, ConcurrentJarCreator zOut, String v
595
586
596
587
if ( dir != null && dir .isExisting () )
597
588
{
598
- setTime ( ze , dir .getLastModified () );
589
+ setZipEntryTime ( ze , dir .getLastModified () );
599
590
}
600
591
else
601
592
{
602
593
// ZIPs store time with a granularity of 2 seconds, round up
603
- setTime ( ze , System .currentTimeMillis () );
594
+ setZipEntryTime ( ze , System .currentTimeMillis () );
604
595
}
605
596
if ( !isSymlink )
606
597
{
0 commit comments