Skip to content

Commit 2aec2ba

Browse files
Sergey Patrikeevplamentotev
Sergey Patrikeev
authored andcommitted
Remove code duplication.
1 parent 4978d77 commit 2aec2ba

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipUnArchiver.java

+3-25
Original file line numberDiff line numberDiff line change
@@ -158,31 +158,7 @@ public boolean isExisting()
158158
protected void execute()
159159
throws ArchiverException
160160
{
161-
getLogger().debug( "Expanding: " + getSourceFile() + " into " + getDestDirectory() );
162-
try ( ZipFile zf = new ZipFile( getSourceFile(), encoding, true ) )
163-
{
164-
final Enumeration<ZipArchiveEntry> e = zf.getEntriesInPhysicalOrder();
165-
while ( e.hasMoreElements() )
166-
{
167-
final ZipArchiveEntry ze = e.nextElement();
168-
final ZipEntryFileInfo fileInfo = new ZipEntryFileInfo( zf, ze );
169-
if ( isSelected( fileInfo.getName(), fileInfo ) )
170-
{
171-
try ( InputStream in = zf.getInputStream( ze ) )
172-
{
173-
extractFile( getSourceFile(), getDestDirectory(), in, fileInfo.getName(),
174-
new Date( ze.getTime() ), ze.isDirectory(),
175-
ze.getUnixMode() != 0 ? ze.getUnixMode() : null,
176-
resolveSymlink( zf, ze ), getFileMappers() );
177-
}
178-
}
179-
}
180-
getLogger().debug( "expand complete" );
181-
}
182-
catch ( final IOException ioe )
183-
{
184-
throw new ArchiverException( "Error while expanding " + getSourceFile().getAbsolutePath(), ioe );
185-
}
161+
execute( "", getDestDirectory() );
186162
}
187163

188164
private String resolveSymlink( ZipFile zf, ZipArchiveEntry ze )
@@ -202,6 +178,7 @@ private String resolveSymlink( ZipFile zf, ZipArchiveEntry ze )
202178
protected void execute( final String path, final File outputDirectory )
203179
throws ArchiverException
204180
{
181+
getLogger().debug( "Expanding: " + getSourceFile() + " into " + outputDirectory );
205182
try ( ZipFile zipFile = new ZipFile( getSourceFile(), encoding, true ) )
206183
{
207184
final Enumeration<ZipArchiveEntry> e = zipFile.getEntriesInPhysicalOrder();
@@ -226,6 +203,7 @@ protected void execute( final String path, final File outputDirectory )
226203
}
227204
}
228205
}
206+
getLogger().debug( "expand complete" );
229207
}
230208
catch ( final IOException ioe )
231209
{

0 commit comments

Comments
 (0)