summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/spigotmc/builder/Builder.java62
1 files changed, 34 insertions, 28 deletions
diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java
index 3204307..c11c47a 100644
--- a/src/main/java/org/spigotmc/builder/Builder.java
+++ b/src/main/java/org/spigotmc/builder/Builder.java
@@ -668,42 +668,48 @@ public class Builder
targetFolder.mkdir();
ZipFile zip = new ZipFile( zipFile );
- for ( Enumeration<? extends ZipEntry> entries = zip.entries(); entries.hasMoreElements(); )
+ try
{
- ZipEntry entry = entries.nextElement();
-
- if ( filter != null )
+ for ( Enumeration<? extends ZipEntry> entries = zip.entries(); entries.hasMoreElements(); )
{
- if ( !filter.apply( entry.getName() ) )
+ ZipEntry entry = entries.nextElement();
+
+ if ( filter != null )
{
- continue;
+ if ( !filter.apply( entry.getName() ) )
+ {
+ continue;
+ }
}
- }
- File outFile = new File( targetFolder, entry.getName() );
+ File outFile = new File( targetFolder, entry.getName() );
- if ( entry.isDirectory() )
- {
- outFile.mkdirs();
- continue;
- }
- if ( outFile.getParentFile() != null )
- {
- outFile.getParentFile().mkdirs();
- }
+ if ( entry.isDirectory() )
+ {
+ outFile.mkdirs();
+ continue;
+ }
+ if ( outFile.getParentFile() != null )
+ {
+ outFile.getParentFile().mkdirs();
+ }
- InputStream is = zip.getInputStream( entry );
- OutputStream os = new FileOutputStream( outFile );
- try
- {
- ByteStreams.copy( is, os );
- } finally
- {
- is.close();
- os.close();
- }
+ InputStream is = zip.getInputStream( entry );
+ OutputStream os = new FileOutputStream( outFile );
+ try
+ {
+ ByteStreams.copy( is, os );
+ } finally
+ {
+ is.close();
+ os.close();
+ }
- System.out.println( "Extracted: " + outFile );
+ System.out.println( "Extracted: " + outFile );
+ }
+ } finally
+ {
+ zip.close();
}
}