Skip to content

Commit 52a9a1f

Browse files
committed
[MDEP-651] Warn on duplicate archive entries
If there's an file system entry for the archive entry, a warning is logged. If overwrite is false, extraction is aborted.
1 parent faa4d22 commit 52a9a1f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,13 @@ protected void extractFile( final File srcF, final File dir, final InputStream c
343343

344344
try
345345
{
346-
if ( !isOverwrite() && f.exists() && ( f.lastModified() >= entryDate.getTime() ) )
346+
if ( f.exists() && ( f.lastModified() >= entryDate.getTime() ) )
347347
{
348-
return;
348+
String message = String.format( "Archive entry %s already exists on disk and is newer", entryName );
349+
getLogger().warn( message );
350+
if ( !isOverwrite() ) {
351+
return;
352+
}
349353
}
350354

351355
// create intermediary directories - sometimes zip don't add them

0 commit comments

Comments
 (0)