diff options
author | Lex Spoon <lex@lexspoon.org> | 2006-06-22 13:58:01 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2006-06-22 13:58:01 +0000 |
commit | 1ab98be85b4a4ecdfb7afdf0c98bd0ef7e634b4e (patch) | |
tree | be5a5053b949bce5fe502965438691cc73fea5c5 /src/compiler | |
parent | d0ff5e5680be0d73657c69efb838834a7524886d (diff) | |
download | scala-1ab98be85b4a4ecdfb7afdf0c98bd0ef7e634b4e.tar.gz scala-1ab98be85b4a4ecdfb7afdf0c98bd0ef7e634b4e.tar.bz2 scala-1ab98be85b4a4ecdfb7afdf0c98bd0ef7e634b4e.zip |
Do not suppress ClassNotFoundException, NoSuchM...
Do not suppress ClassNotFoundException, NoSuchMethodError, or
InvocationTargetException. Document that the caller must handle them.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/ObjectRunner.scala | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala index d64ad2947d..64aafb0007 100644 --- a/src/compiler/scala/tools/nsc/ObjectRunner.scala +++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala @@ -13,24 +13,23 @@ import java.net.URLClassLoader /** An object that runs another object specified by name. */ object ObjectRunner { + /** Run a given object, specified by name, using a + * specified classpath and argument list. + * + * Throws: ClassNotFoundException, NoSuchMtehodError, + * InvocationTargetException + */ def run( classpath: List[String], objectName: String, arguments: Seq[String]): Unit = - try { + { val classpathURLs = classpath.map(s => new File(s).toURL).toArray val mainLoader = new URLClassLoader(classpathURLs, null) val clsToRun = Class.forName(objectName, true, mainLoader) val method = clsToRun.getMethod("main", List(classOf[Array[String]]).toArray) - val res = method.invoke(null, List(arguments.toArray).toArray) - () - } catch { - case e: Exception => - // ClassNotFoundException, InvocationTargetException, NoSuchMethod .. - Console.println(e) - exit(1) - } - + method.invoke(null, List(arguments.toArray).toArray) + } } |