New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it fails if passing an empty parameter to a script #747

Closed
dportabella opened this Issue Feb 6, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@dportabella
Contributor

dportabella commented Feb 6, 2018

Test.sc:

@main
def main(name: String) { ??? }
$ amm Test.sc john
# ok, as expected

$ amm Test.sc ""
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(String.java:658)
	at scala.collection.immutable.StringOps$.apply$extension(StringOps.scala:37)
	at ammonite.main.Router$EntryPoint$$anonfun$invoke$2.apply(Router.scala:79)
	at ammonite.main.Router$EntryPoint$$anonfun$invoke$2.apply(Router.scala:75)
	at scala.collection.Iterator$class.foreach(Iterator.scala:891)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
	at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
	at ammonite.main.Router$EntryPoint.invoke(Router.scala:75)
	at ammonite.main.Scripts$.runMainMethod(Scripts.scala:182)
	at ammonite.main.Scripts$$anonfun$runScript$1$$anonfun$apply$1$$anonfun$apply$3$$anonfun$apply$4.apply(Scripts.scala:96)
	at ammonite.main.Scripts$$anonfun$runScript$1$$anonfun$apply$1$$anonfun$apply$3$$anonfun$apply$4.apply(Scripts.scala:83)
	at ammonite.util.Util$.withContextClassloader(Util.scala:16)
	at ammonite.main.Scripts$$anonfun$runScript$1$$anonfun$apply$1$$anonfun$apply$3.apply(Scripts.scala:82)
	at ammonite.main.Scripts$$anonfun$runScript$1$$anonfun$apply$1$$anonfun$apply$3.apply(Scripts.scala:65)
	at ammonite.util.Res$Success.flatMap(Res.scala:56)
	at ammonite.main.Scripts$$anonfun$runScript$1$$anonfun$apply$1.apply(Scripts.scala:65)
	at ammonite.main.Scripts$$anonfun$runScript$1$$anonfun$apply$1.apply(Scripts.scala:45)
	at ammonite.util.Res$Success.flatMap(Res.scala:56)
	at ammonite.main.Scripts$$anonfun$runScript$1.apply(Scripts.scala:45)
	at ammonite.main.Scripts$$anonfun$runScript$1.apply(Scripts.scala:42)
	at ammonite.util.Res$Success.flatMap(Res.scala:56)
	at ammonite.main.Scripts$.runScript(Scripts.scala:42)
	at ammonite.Main.runScript(Main.scala:210)
	at ammonite.MainRunner$$anonfun$runScript$1.apply(Main.scala:350)
	at ammonite.MainRunner$$anonfun$runScript$1.apply(Main.scala:350)
	at ammonite.MainRunner.watchLoop(Main.scala:336)
	at ammonite.MainRunner.runScript(Main.scala:347)
	at ammonite.Main$.main0(Main.scala:290)
	at ammonite.Main$.main(Main.scala:241)
	at ammonite.Main.main(Main.scala)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment