diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-08-27 20:08:35 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-08-27 20:08:35 +0200 |
commit | 5e8bc196cebcbaf86a63330cf0474909f72a6fe0 (patch) | |
tree | a849a804acf8a33af9de7ee3d377a34cc3796cc3 /src | |
parent | 4254b47acbe703dfcab655a55b3cd2f6102ece05 (diff) | |
download | scala-5e8bc196cebcbaf86a63330cf0474909f72a6fe0.tar.gz scala-5e8bc196cebcbaf86a63330cf0474909f72a6fe0.tar.bz2 scala-5e8bc196cebcbaf86a63330cf0474909f72a6fe0.zip |
A better diagnostic error for corrupt or missing JARs.
Augment the IOException with the name of the file we're trying
to open.
Motivated by a troubleshooting session with partial downloads
of JARs from Maven central breaking the Scala build on Martin's
laptop.
The test case only tests our part of the error message, so as not
to be platform / JDK specific. Otherwise, it would check that the
correct cause exception was present and accounted for.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/io/ZipArchive.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/io/ZipArchive.scala b/src/reflect/scala/reflect/io/ZipArchive.scala index eabf1dcbab..8260189459 100644 --- a/src/reflect/scala/reflect/io/ZipArchive.scala +++ b/src/reflect/scala/reflect/io/ZipArchive.scala @@ -126,7 +126,11 @@ abstract class ZipArchive(override val file: JFile) extends AbstractFile with Eq /** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */ final class FileZipArchive(file: JFile) extends ZipArchive(file) { def iterator: Iterator[Entry] = { - val zipFile = new ZipFile(file) + val zipFile = try { + new ZipFile(file) + } catch { + case ioe: IOException => throw new IOException("Error accessing " + file.getPath, ioe) + } val root = new DirEntry("/") val dirs = mutable.HashMap[String, DirEntry]("/" -> root) val enum = zipFile.entries() |