mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-04 13:49:13 +01:00
JarFile/ZipFile does not implement closeable in java 6
This commit is contained in:
@@ -127,10 +127,7 @@ public abstract class AbstractBaseScmMojo extends AbstractScmMojo
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (scanner != null)
|
||||
{
|
||||
scanner.close();
|
||||
}
|
||||
Util.close(scanner);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
@@ -140,7 +137,7 @@ public abstract class AbstractBaseScmMojo extends AbstractScmMojo
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(input);
|
||||
IOUtils.closeQuietly(file);
|
||||
Util.close(getLog(), file);
|
||||
}
|
||||
|
||||
return excludeList;
|
||||
|
||||
@@ -33,6 +33,17 @@
|
||||
|
||||
package sonia.scm.maven;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Scanner;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -40,6 +51,44 @@ package sonia.scm.maven;
|
||||
public class Util
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param log
|
||||
* @param file
|
||||
*/
|
||||
public static void close(Log log, ZipFile file)
|
||||
{
|
||||
if (file != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.warn("could not close zipfile", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param scanner
|
||||
*/
|
||||
public static void close(Scanner scanner)
|
||||
{
|
||||
if (scanner != null)
|
||||
{
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user