diff options
author | peterz <peterz@rambler.ru> | 2016-05-10 11:54:21 +0300 |
---|---|---|
committer | petermz <peter.zhelezniakov@gmail.com> | 2016-05-17 17:22:45 +0300 |
commit | 883fdd74d63a54495f4013eef81c9b5ebc850d1c (patch) | |
tree | 6c4d97ead6446ce0ebbe980980454ca3614f7523 /src/compiler | |
parent | 3ea78b7583a5b69065b532697372e669e4bbadce (diff) | |
download | scala-883fdd74d63a54495f4013eef81c9b5ebc850d1c.tar.gz scala-883fdd74d63a54495f4013eef81c9b5ebc850d1c.tar.bz2 scala-883fdd74d63a54495f4013eef81c9b5ebc850d1c.zip |
SI-5463 Check .jars before using them
Make broken JAR files on compiler classpath cause a fatal error
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/classpath/AggregateClassPath.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/classpath/AggregateClassPath.scala b/src/compiler/scala/tools/nsc/classpath/AggregateClassPath.scala index 6b435542a3..a1af3413ea 100644 --- a/src/compiler/scala/tools/nsc/classpath/AggregateClassPath.scala +++ b/src/compiler/scala/tools/nsc/classpath/AggregateClassPath.scala @@ -6,6 +6,7 @@ package scala.tools.nsc.classpath import java.net.URL import scala.annotation.tailrec import scala.collection.mutable.ArrayBuffer +import scala.reflect.internal.FatalError import scala.reflect.io.AbstractFile import scala.tools.nsc.util.ClassPath import scala.tools.nsc.util.ClassRepresentation @@ -72,7 +73,16 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath { getDistinctEntries(_.sources(inPackage)) override private[nsc] def list(inPackage: String): ClassPathEntries = { - val (packages, classesAndSources) = aggregates.map(_.list(inPackage)).unzip + val (packages, classesAndSources) = aggregates.map { cp => + try { + cp.list(inPackage) + } catch { + case ex: java.io.IOException => + val e = new FatalError(ex.getMessage) + e.initCause(ex) + throw e + } + }.unzip val distinctPackages = packages.flatten.distinct val distinctClassesAndSources = mergeClassesAndSources(classesAndSources: _*) ClassPathEntries(distinctPackages, distinctClassesAndSources) |