Skip to content

Commit b6f5499

Browse files
committed
[MDEP-651] Rename variables
1 parent 6b03a0e commit b6f5499

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

+13-13
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,11 @@ protected void extractFile( final File srcF, final File dir, final InputStream c
330330
}
331331

332332
// Hmm. Symlinks re-evaluate back to the original file here. Unsure if this is a good thing...
333-
final File f = FileUtils.resolveFile( dir, entryName );
333+
final File targetFileName = FileUtils.resolveFile( dir, entryName );
334334

335335
// Make sure that the resolved path of the extracted file doesn't escape the destination directory
336336
String canonicalDirPath = dir.getCanonicalPath();
337-
String canonicalDestPath = f.getCanonicalPath();
337+
String canonicalDestPath = targetFileName.getCanonicalPath();
338338

339339
if ( !canonicalDestPath.startsWith( canonicalDirPath ) )
340340
{
@@ -343,25 +343,25 @@ protected void extractFile( final File srcF, final File dir, final InputStream c
343343

344344
try
345345
{
346-
if ( !shouldExtractEntry( f, entryName, entryDate ) )
346+
if ( !shouldExtractEntry( targetFileName, entryName, entryDate ) )
347347
{
348348
return;
349349
}
350350

351351
// create intermediary directories - sometimes zip don't add them
352-
final File dirF = f.getParentFile();
352+
final File dirF = targetFileName.getParentFile();
353353
if ( dirF != null )
354354
{
355355
dirF.mkdirs();
356356
}
357357

358358
if ( !StringUtils.isEmpty( symlinkDestination ) )
359359
{
360-
SymlinkUtils.createSymbolicLink( f, new File( symlinkDestination ) );
360+
SymlinkUtils.createSymbolicLink( targetFileName, new File( symlinkDestination ) );
361361
}
362362
else if ( isDirectory )
363363
{
364-
f.mkdirs();
364+
targetFileName.mkdirs();
365365
}
366366
else
367367
{
@@ -371,37 +371,37 @@ else if ( isDirectory )
371371
}
372372
}
373373

374-
f.setLastModified( entryDate.getTime() );
374+
targetFileName.setLastModified( entryDate.getTime() );
375375

376376
if ( !isIgnorePermissions() && mode != null && !isDirectory )
377377
{
378-
ArchiveEntryUtils.chmod( f, mode );
378+
ArchiveEntryUtils.chmod( targetFileName, mode );
379379
}
380380
}
381381
catch ( final FileNotFoundException ex )
382382
{
383-
getLogger().warn( "Unable to expand to file " + f.getPath() );
383+
getLogger().warn( "Unable to expand to file " + targetFileName.getPath() );
384384
}
385385
}
386386

387387
// Visible for testing
388-
protected boolean shouldExtractEntry( File file, String entryName, Date entryDate ) throws IOException
388+
protected boolean shouldExtractEntry( File targetFileName, String entryName, Date entryDate ) throws IOException
389389
{
390390
// entryname | entrydate | filename | filedate | behavior
391391
// (1) readme.txt | 1970 | readme.txt | 2020 | never overwrite
392392
// (2) readme.txt | 2020 | readme.txt | 1970 | only overwrite when isOverWrite()
393393
// (3) README.txt | 1970 | readme.txt | 2020 | warn + never overwrite
394394
// (4) README.txt | 2020 | readme.txt | 1970 | warn + only overwrite when isOverWrite()
395395

396-
String canonicalDestPath = file.getCanonicalPath();
397-
boolean fileOnDiskIsNewerThanEntry = ( file.lastModified() >= entryDate.getTime() );
396+
String canonicalDestPath = targetFileName.getCanonicalPath();
397+
boolean fileOnDiskIsNewerThanEntry = targetFileName.lastModified() >= entryDate.getTime();
398398
boolean differentCasing = !StringUtils.equalsIgnoreCase( entryName, canonicalDestPath );
399399

400400
String casingMessage = String.format( "Archive entry '%s' and existing file '%s' names differ only by case."
401401
+ " This may cause issues on case-insensitive filesystems.", entryName, canonicalDestPath );
402402

403403
// Optimise for situation where we need no checks
404-
if ( !file.exists() )
404+
if ( !targetFileName.exists() )
405405
{
406406
return true;
407407
}

0 commit comments

Comments
 (0)