[MSHARED-87] ZipException throw by SDK's JarFile constructor may lack file name.
Submitted by Jerome Lacoste.
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@811555 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java b/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java
index 3d27894..a063ee0 100644
--- a/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java
+++ b/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java
@@ -32,6 +32,7 @@
import java.util.jar.Manifest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.zip.ZipException;
/**
* Open a JAR file to be analyzed. Note that once created, the {@link #closeQuietly()} method should be called to
@@ -99,7 +100,16 @@
public JarAnalyzer( File file )
throws IOException
{
- this.jarFile = new JarFile( file );
+ try
+ {
+ this.jarFile = new JarFile( file );
+ }
+ catch ( ZipException e )
+ {
+ ZipException ioe = new ZipException( "Failed to open file " + file + " : " + e.getMessage() );
+ ioe.initCause( e );
+ throw ioe;
+ }
// Obtain entries list.
List entries = Collections.list( jarFile.entries() );