-
Notifications
You must be signed in to change notification settings - Fork 405
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
Intermittent (and rare) java.lang.reflect.InvocationTargetException #167
Comments
The underlying cause is due to calling Option.get, which you should never You are calling the Gen directly, which isn't normally how you'd use On 25 May 2015 at 07:59, Zacharias J. Beckman notifications@github.com
|
sounds like we should just close this? |
👍 |
I've written a helper function to generate one-off randomized names. On rare occasions, it generates a java.lang.reflect.InvocationTargetException.
The relevant code:
The final line (above) is the line that generates:
[error] java.lang.reflect.InvocationTargetException
[error] caused by java.util.NoSuchElementException: None.get
This is pretty rare. I wrote a small unit test to reproduce it:
This test runs successfully several times in a row, but will fail roughly once every five times I run it, generating the following stack trace:
[error] java.lang.reflect.InvocationTargetException
[error] caused by java.util.NoSuchElementException: None.get
[error]
[error] STACKTRACE
[error] sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] java.lang.reflect.Constructor.newInstance(Constructor.java:408)
[error] org.specs2.reflect.Classes$$anonfun$org$specs2$reflect$Classes$$createInstanceForConstructor$1$$anonfun$apply$11.apply(Classes.scala:105)
[error] org.specs2.control.ActionT$$anonfun$safe$1.apply(ActionT.scala:89)
[error] org.specs2.control.ActionT$$anonfun$reader$1$$anonfun$apply$6.apply(ActionT.scala:80)
[error] org.specs2.control.Status$.safe(Status.scala:100)
[error] org.specs2.control.StatusT$$anonfun$safe$1.apply(StatusT.scala:62)
[error] org.specs2.control.StatusT$$anonfun$safe$1.apply(StatusT.scala:62)
[error] scalaz.syntax.ToApplicativeOps$$anon$1.self$lzycompute(ApplicativeSyntax.scala:29)
[error] scalaz.syntax.ToApplicativeOps$$anon$1.self(ApplicativeSyntax.scala:29)
[error] scalaz.syntax.ToApplicativeOps$ApplicativeIdV$$anonfun$point$1.apply(ApplicativeSyntax.scala:33)
[error] scalaz.WriterTApplicative$$anonfun$point$1.apply(WriterT.scala:268)
[error] scalaz.WriterTApplicative$$anonfun$point$1.apply(WriterT.scala:268)
[error] scalaz.effect.IO$$anonfun$apply$19$$anonfun$apply$20.apply(IO.scala:136)
[error] scalaz.effect.IO$$anonfun$apply$19$$anonfun$apply$20.apply(IO.scala:136)
[error] scalaz.FreeFunctions$$anonfun$return_$1.apply(Free.scala:326)
[error] scalaz.FreeFunctions$$anonfun$return_$1.apply(Free.scala:326)
[error] scalaz.std.FunctionInstances$$anon$1$$anonfun$map$1.apply(Function.scala:56)
[error] scalaz.Free$$anonfun$run$1.apply(Free.scala:172)
[error] scalaz.Free$$anonfun$run$1.apply(Free.scala:172)
[error] scalaz.Free.go2$1(Free.scala:119)
[error] scalaz.Free.go(Free.scala:122)
[error] scalaz.Free.run(Free.scala:172)
[error] scalaz.effect.IO$class.unsafePerformIO(IO.scala:22)
[error] scalaz.effect.IOFunctions$$anon$6.unsafePerformIO(IO.scala:227)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1$$anonfun$3.apply(Classes.scala:38)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1$$anonfun$3.apply(Classes.scala:37)
[error] scala.collection.immutable.List.map(List.scala:273)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1.apply(Classes.scala:37)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1.apply(Classes.scala:30)
[error] scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
[error] org.specs2.control.Status$class.fold(Status.scala:30)
[error] org.specs2.control.Ok.fold(Status.scala:95)
[error] org.specs2.control.Status$class.flatMap(Status.scala:48)
[error] org.specs2.control.Ok.flatMap(Status.scala:95)
[error] org.specs2.control.Status$class.map(Status.scala:45)
[error] org.specs2.control.Ok.map(Status.scala:95)
[error] org.specs2.control.StatusT$$anonfun$map$1.apply(StatusT.scala:16)
[error] org.specs2.control.StatusT$$anonfun$map$1.apply(StatusT.scala:16)
[error] scalaz.WriterT$$anonfun$map$1.apply(WriterT.scala:46)
[error] scalaz.WriterT$$anonfun$map$1.apply(WriterT.scala:46)
[error] scalaz.effect.IO$$anonfun$map$1$$anonfun$apply$8.apply(IO.scala:56)
[error] scalaz.effect.IO$$anonfun$map$1$$anonfun$apply$8.apply(IO.scala:55)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52)
[error] scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error] scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error] scalaz.Free.resume(Free.scala:72)
[error] scalaz.Free.go2$1(Free.scala:118)
[error] scalaz.Free.go(Free.scala:122)
[error] scalaz.Free.run(Free.scala:172)
[error] scalaz.effect.IO$class.unsafePerformIO(IO.scala:22)
[error] scalaz.effect.IOFunctions$$anon$6.unsafePerformIO(IO.scala:227)
[error] org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$4.execute(SbtRunner.scala:40)
[error] sbt.ForkMain$Run$2.call(ForkMain.java:294)
[error] sbt.ForkMain$Run$2.call(ForkMain.java:284)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] java.lang.Thread.run(Thread.java:745)
[error]
[error] CAUSED BY java.util.NoSuchElementException: None.get
[error] scala.None$.get(Option.scala:347)
[error] scala.None$.get(Option.scala:345)
[error] utility.GPTestUtilities$class.$init$(GPTestUtilities.scala:181)
[error] models.TestDataTypes.(TestDataTypes.scala:20)
[error] sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] java.lang.reflect.Constructor.newInstance(Constructor.java:408)
[error] org.specs2.reflect.Classes$$anonfun$org$specs2$reflect$Classes$$createInstanceForConstructor$1$$anonfun$apply$11.apply(Classes.scala:105)
[error] org.specs2.control.ActionT$$anonfun$safe$1.apply(ActionT.scala:89)
[error] org.specs2.control.ActionT$$anonfun$reader$1$$anonfun$apply$6.apply(ActionT.scala:80)
[error] org.specs2.control.Status$.safe(Status.scala:100)
[error] org.specs2.control.StatusT$$anonfun$safe$1.apply(StatusT.scala:62)
[error] org.specs2.control.StatusT$$anonfun$safe$1.apply(StatusT.scala:62)
[error] scalaz.syntax.ToApplicativeOps$$anon$1.self$lzycompute(ApplicativeSyntax.scala:29)
[error] scalaz.syntax.ToApplicativeOps$$anon$1.self(ApplicativeSyntax.scala:29)
[error] scalaz.syntax.ToApplicativeOps$ApplicativeIdV$$anonfun$point$1.apply(ApplicativeSyntax.scala:33)
[error] scalaz.WriterTApplicative$$anonfun$point$1.apply(WriterT.scala:268)
[error] scalaz.WriterTApplicative$$anonfun$point$1.apply(WriterT.scala:268)
[error] scalaz.effect.IO$$anonfun$apply$19$$anonfun$apply$20.apply(IO.scala:136)
[error] scalaz.effect.IO$$anonfun$apply$19$$anonfun$apply$20.apply(IO.scala:136)
[error] scalaz.FreeFunctions$$anonfun$return_$1.apply(Free.scala:326)
[error] scalaz.FreeFunctions$$anonfun$return_$1.apply(Free.scala:326)
[error] scalaz.std.FunctionInstances$$anon$1$$anonfun$map$1.apply(Function.scala:56)
[error] scalaz.Free$$anonfun$run$1.apply(Free.scala:172)
[error] scalaz.Free$$anonfun$run$1.apply(Free.scala:172)
[error] scalaz.Free.go2$1(Free.scala:119)
[error] scalaz.Free.go(Free.scala:122)
[error] scalaz.Free.run(Free.scala:172)
[error] scalaz.effect.IO$class.unsafePerformIO(IO.scala:22)
[error] scalaz.effect.IOFunctions$$anon$6.unsafePerformIO(IO.scala:227)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1$$anonfun$3.apply(Classes.scala:38)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1$$anonfun$3.apply(Classes.scala:37)
[error] scala.collection.immutable.List.map(List.scala:273)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1.apply(Classes.scala:37)
[error] org.specs2.reflect.Classes$$anonfun$createInstance$1$$anonfun$apply$1.apply(Classes.scala:30)
[error] scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
[error] org.specs2.control.Status$class.fold(Status.scala:30)
[error] org.specs2.control.Ok.fold(Status.scala:95)
[error] org.specs2.control.Status$class.flatMap(Status.scala:48)
[error] org.specs2.control.Ok.flatMap(Status.scala:95)
[error] org.specs2.control.Status$class.map(Status.scala:45)
[error] org.specs2.control.Ok.map(Status.scala:95)
[error] org.specs2.control.StatusT$$anonfun$map$1.apply(StatusT.scala:16)
[error] org.specs2.control.StatusT$$anonfun$map$1.apply(StatusT.scala:16)
[error] scalaz.WriterT$$anonfun$map$1.apply(WriterT.scala:46)
[error] scalaz.WriterT$$anonfun$map$1.apply(WriterT.scala:46)
[error] scalaz.effect.IO$$anonfun$map$1$$anonfun$apply$8.apply(IO.scala:56)
[error] scalaz.effect.IO$$anonfun$map$1$$anonfun$apply$8.apply(IO.scala:55)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52)
[error] scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error] scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error] scalaz.Free.resume(Free.scala:72)
[error] scalaz.Free.go2$1(Free.scala:118)
[error] scalaz.Free.go(Free.scala:122)
[error] scalaz.Free.run(Free.scala:172)
[error] scalaz.effect.IO$class.unsafePerformIO(IO.scala:22)
[error] scalaz.effect.IOFunctions$$anon$6.unsafePerformIO(IO.scala:227)
[error] org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$4.execute(SbtRunner.scala:40)
[error] sbt.ForkMain$Run$2.call(ForkMain.java:294)
[error] sbt.ForkMain$Run$2.call(ForkMain.java:284)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] java.lang.Thread.run(Thread.java:745)
The text was updated successfully, but these errors were encountered: