val route = pathPrefix("users") {
...
}
val blockingEndpoint = (pathPrefix("users" / "blocked") & authentication) {issuerId =>
path(JavaUUID) {blockeeId =>
put {
complete{HttpResponse(NotImplemented)}
} ~
delete {
complete{HttpResponse(NotImplemented)}
}
} ~
get {
complete{HttpResponse(NotImplemented)}
}
}
Now, if I simply do:
val route = pathPrefix("users") {
...
} ~
blockingEndpoint
java.lang.NullPointerException: null
at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation$$anonfun$$tilde$1$$anonfun$apply$1.apply(RouteConcatenation.scala:28) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation$$anonfun$$tilde$1$$anonfun$apply$1.apply(RouteConcatenation.scala:25) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.util.FastFuture$.akka$http$scaladsl$util$FastFuture$$strictTransform$1(FastFuture.scala:41) ~[akka-http-core-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.util.FastFuture$.transformWith$extension1(FastFuture.scala:45) ~[akka-http-core-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.util.FastFuture$.flatMap$extension(FastFuture.scala:26) ~[akka-http-core-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation$$anonfun$$tilde$1.apply(RouteConcatenation.scala:25) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation$$anonfun$$tilde$1.apply(RouteConcatenation.scala:23) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.directives.BasicDirectives$$anonfun$mapRouteResultWith$1$$anonfun$apply$4.apply(BasicDirectives.scala:35) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.directives.BasicDirectives$$anonfun$mapRouteResultWith$1$$anonfun$apply$4.apply(BasicDirectives.scala:35) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.directives.BasicDirectives$$anonfun$textract$1$$anonfun$apply$5.apply(BasicDirectives.scala:88) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.directives.BasicDirectives$$anonfun$textract$1$$anonfun$apply$5.apply(BasicDirectives.scala:88) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$1.apply(ExecutionDirectives.scala:27) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.directives.ExecutionDirectives$$anonfun$handleExceptions$1$$anonfun$apply$1.apply(ExecutionDirectives.scala:23) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.Route$$anonfun$asyncHandler$1.apply(Route.scala:64) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.http.scaladsl.server.Route$$anonfun$asyncHandler$1.apply(Route.scala:63) ~[akka-http-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.MapAsync$$anon$9$$anon$10.onPush(Ops.scala:590) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.GraphInterpreter.processElement$1(GraphInterpreter.scala:575) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:586) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:533) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:445) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.GraphInterpreterShell.receive(ActorGraphInterpreter.scala:400) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:549) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.actor.Actor$class.aroundReceive(Actor.scala:480) ~[akka-actor_2.11-2.4.1.jar:na]
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:495) ~[akka-stream-experimental_2.11-2.0.2.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) [akka-actor_2.11-2.4.1.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:495) [akka-actor_2.11-2.4.1.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) [akka-actor_2.11-2.4.1.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:224) [akka-actor_2.11-2.4.1.jar:na]
at akka.dispatch.Mailbox.exec(Mailbox.scala:234) [akka-actor_2.11-2.4.1.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.7.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.7.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.7.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.7.jar:na]
val route = pathPrefix("users") {
...
} ~
(pathPrefix("users" / "blocked") & authentication) {issuerId =>
path(JavaUUID) {blockeeId => --
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
...
On 29 March 2016 at 04:28:40, Pouria Mellati (pou...@takor.com.au) wrote:
Thanks Konrad, this should fix the issue!
Yup, happy hakking!
I think this sort of issue should be pointed out by the compiler, rather than at runtime. Not sure if it is possible though.
In simple cases Scala actually does notify about that, simple forward references etc.
In more complex cases it's not trivial sadly so it doesn't (nowadays, perhaps it can be improved in future scalac versions).
-- Konrad