diff options
author | Paul Phillips <paulp@improving.org> | 2010-10-26 06:00:03 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-10-26 06:00:03 +0000 |
commit | cab41b68581f32e56491b4bfdcbb931a4abe3689 (patch) | |
tree | 6375579d0ade087ec4b7bed3faacf7a87620bcb8 /src | |
parent | 6de5505cd98b8d852b1b63e3f0ec1e48e9deb701 (diff) | |
download | scala-cab41b68581f32e56491b4bfdcbb931a4abe3689.tar.gz scala-cab41b68581f32e56491b4bfdcbb931a4abe3689.tar.bz2 scala-cab41b68581f32e56491b4bfdcbb931a4abe3689.zip |
Another attempt to fix a bug which has plagued ...
Another attempt to fix a bug which has plagued me for a year or more but
which I am apparently the only one who enjoys it. I enclose some thread
dumps in anticipation that someday someone else will experience it too.
No review.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/io/ZipArchive.scala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/io/ZipArchive.scala b/src/compiler/scala/tools/nsc/io/ZipArchive.scala index e65e0040c0..21ec95d338 100644 --- a/src/compiler/scala/tools/nsc/io/ZipArchive.scala +++ b/src/compiler/scala/tools/nsc/io/ZipArchive.scala @@ -53,6 +53,9 @@ object ZipArchive { def foreach[U](f: ZipEntry => U) = { var in: ZipInputStream = null @tailrec def loop(): Unit = { + if (in.available == 0) + return + val entry = in.getNextEntry() if (entry != null) { f(entry) @@ -74,8 +77,7 @@ object ZipArchive { * ZipArchive (backed by a zip file) and URLZipArchive (backed * by an InputStream.) */ -private[io] trait ZipContainer extends AbstractFile -{ +private[io] trait ZipContainer extends AbstractFile { /** Abstract types */ type SourceType // InputStream or AbstractFile type CreationType // InputStream or ZipFile @@ -245,7 +247,11 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file) private def zipTraversableFromZipFile(z: ZipFile): ZipTrav = new Iterable[ZipEntry] { def zis: () => ZipInputStream = null // not valid for this type - def iterator = asIterator(z.entries()) + def iterator = new Iterator[ZipEntry] { + val enum = z.entries() + def hasNext = enum.hasMoreElements + def next = enum.nextElement + } } } @@ -256,8 +262,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file) * @author Stephane Micheloud * @version 1.0, 29/05/2007 */ -final class URLZipArchive(url: URL) extends AbstractFile with ZipContainer -{ +final class URLZipArchive(url: URL) extends AbstractFile with ZipContainer { type SourceType = InputStream type CreationType = InputStream |