This page is no longer maintained — Please continue to the home page at www.scala-lang.org

AbstractPartialFunction throws NPE

2 replies
gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Hi,
After rebuilding Play 2.0 with Scala virtualized (which follows very closely master) I ran tests and got:
java.lang.NullPointerException: null at scala.runtime.AbstractPartialFunction.orElse(AbstractPartialFunction.scala:41) ~[scala-library.jar:0.11.2] at akka.routing.Router$class.receive(Routing.scala:130) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RouterConfig$$anon$1.receive(Routing.scala:85) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.Actor$class.$init$(Actor.scala:291) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RouterConfig$$anon$1.<init>(Routing.scala:85) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RouterConfig$class.createActor(Routing.scala:85) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RoundRobinRouter.createActor(Routing.scala:204) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RoutedActorRef$$anonfun$$init$$1.apply(Routing.scala:19) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RoutedActorRef$$anonfun$$init$$1.apply(Routing.scala:19) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.ActorCell.newActor(ActorCell.scala:340) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.ActorCell.create$1(ActorCell.scala:357) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.ActorCell.systemInvoke(ActorCell.scala:447) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:210) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.dispatch.Mailbox.run(Mailbox.scala:164) ~[akka-actor-2.0-M2.jar:2.0-M2]
The relevant line is: https://github.com/scala/scala/blob/master/src/library/scala/runtime/AbstractPartialFunction.scala#L41
By analyzing this line it looks like it is result that must be null, right? I don't have any small test-case reproducing this problem but I guess Akka guys could come up with something fairly quickly.
--
Grzegorz Kossakowski

adriaanm
Joined: 2010-02-08,
User offline. Last seen 31 weeks 4 days ago.
Re: AbstractPartialFunction throws NPE
Is https://issues.scala-lang.org/browse/SI-5300 related? I can't check right now whether that fix is in M1. 

On 25 Jan 2012, at 08:03, Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> wrote:

Hi,
After rebuilding Play 2.0 with Scala virtualized (which follows very closely master) I ran tests and got:
java.lang.NullPointerException: null at scala.runtime.AbstractPartialFunction.orElse(AbstractPartialFunction.scala:41) ~[scala-library.jar:0.11.2] at akka.routing.Router$class.receive(Routing.scala:130) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RouterConfig$$anon$1.receive(Routing.scala:85) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.Actor$class.$init$(Actor.scala:291) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RouterConfig$$anon$1.<init>(Routing.scala:85) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RouterConfig$class.createActor(Routing.scala:85) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RoundRobinRouter.createActor(Routing.scala:204) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RoutedActorRef$$anonfun$$init$$1.apply(Routing.scala:19) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.routing.RoutedActorRef$$anonfun$$init$$1.apply(Routing.scala:19) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.ActorCell.newActor(ActorCell.scala:340) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.ActorCell.create$1(ActorCell.scala:357) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.actor.ActorCell.systemInvoke(ActorCell.scala:447) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:210) ~[akka-actor-2.0-M2.jar:2.0-M2] at akka.dispatch.Mailbox.run(Mailbox.scala:164) ~[akka-actor-2.0-M2.jar:2.0-M2]
The relevant line is: https://github.com/scala/scala/blob/master/src/library/scala/runtime/AbstractPartialFunction.scala#L41
By analyzing this line it looks like it is result that must be null, right? I don't have any small test-case reproducing this problem but I guess Akka guys could come up with something fairly quickly.
--
Grzegorz Kossakowski

gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Re: AbstractPartialFunction throws NPE
On 25 January 2012 15:10, Adriaan Moors <adriaan.moors@epfl.ch> wrote:
Is https://issues.scala-lang.org/browse/SI-5300 related? I can't check right now whether that fix is in M1. 

It is in M1 but not in virtualized build I'm using. This looks like exactly the same issue so this fix might be enough. However, it's not going to be easy for me to test it now...
--
Grzegorz Kossakowski

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland