diff options
author | Philipp Haller <hallerp@gmail.com> | 2010-04-22 08:04:12 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2010-04-22 08:04:12 +0000 |
commit | dcbffd4dc50c7e2540fd4770492b86108d3254fc (patch) | |
tree | ced3f0c9081b93fd07ff28bd2fcd7f5d0a436fb3 /test/files/jvm | |
parent | 3861a3a42e4347c733a3c15a7cd85fa86d1d1011 (diff) | |
download | scala-dcbffd4dc50c7e2540fd4770492b86108d3254fc.tar.gz scala-dcbffd4dc50c7e2540fd4770492b86108d3254fc.tar.bz2 scala-dcbffd4dc50c7e2540fd4770492b86108d3254fc.zip |
Reactor.exceptionHandler is defined on Throwabl...
Reactor.exceptionHandler is defined on Throwable instead of Exception.
Fixes potential problem with visibility of changes to a field. Review by
plocinic.
Diffstat (limited to 'test/files/jvm')
-rw-r--r-- | test/files/jvm/actor-exceptions.check | 4 | ||||
-rw-r--r-- | test/files/jvm/actor-exceptions.scala | 10 | ||||
-rw-r--r-- | test/files/jvm/actor-link-getstate.check | 3 | ||||
-rw-r--r-- | test/files/jvm/actor-uncaught-exception.check | 7 | ||||
-rw-r--r-- | test/files/jvm/actor-uncaught-exception.scala | 1 | ||||
-rw-r--r-- | test/files/jvm/actor-uncaught-exception2.scala | 1 |
6 files changed, 11 insertions, 15 deletions
diff --git a/test/files/jvm/actor-exceptions.check b/test/files/jvm/actor-exceptions.check index bd44b968cc..d86bac9de5 100644 --- a/test/files/jvm/actor-exceptions.check +++ b/test/files/jvm/actor-exceptions.check @@ -1,3 +1 @@ -Uncaught exception in Slave -Message: A -MyOtherException +OK diff --git a/test/files/jvm/actor-exceptions.scala b/test/files/jvm/actor-exceptions.scala index 384226d777..75dc1e4cd5 100644 --- a/test/files/jvm/actor-exceptions.scala +++ b/test/files/jvm/actor-exceptions.scala @@ -19,6 +19,7 @@ object Master extends Actor { for (i <- 0 until 10) Slave ! A react { case Exit(from, reason) => + println("OK") } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => @@ -29,8 +30,9 @@ object Master extends Actor { object Slave extends Actor { override def toString = "Slave" - override def exceptionHandler: PartialFunction[Exception, Unit] = { + override def exceptionHandler: PartialFunction[Throwable, Unit] = { case MyException(text) => + case other if !other.isInstanceOf[scala.util.control.ControlThrowable] => super.exceptionHandler(other) } def act() { try { @@ -41,12 +43,14 @@ object Slave extends Actor { cnt += 1 if (cnt % 2 != 0) throw MyException("problem") if (cnt == 10) { - throw new MyOtherException("unhandled") + throw MyOtherException("unhandled") } } } } catch { - case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => + case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] && + !e.isInstanceOf[MyException] && + !e.isInstanceOf[MyOtherException] => e.printStackTrace() } } diff --git a/test/files/jvm/actor-link-getstate.check b/test/files/jvm/actor-link-getstate.check index 45967222e6..9755447320 100644 --- a/test/files/jvm/actor-link-getstate.check +++ b/test/files/jvm/actor-link-getstate.check @@ -1,5 +1,2 @@ Done -Uncaught exception in Master -Message: 'done -MyException: Master crashed Terminated diff --git a/test/files/jvm/actor-uncaught-exception.check b/test/files/jvm/actor-uncaught-exception.check index 3e669779df..2c94e48371 100644 --- a/test/files/jvm/actor-uncaught-exception.check +++ b/test/files/jvm/actor-uncaught-exception.check @@ -1,5 +1,2 @@ -Uncaught exception in StartError -MyException: I don't want to run! -Uncaught exception in MessageError -Message: 'ping -MyException: No message for me! +OK +OK diff --git a/test/files/jvm/actor-uncaught-exception.scala b/test/files/jvm/actor-uncaught-exception.scala index 9dbd36dd82..882362272d 100644 --- a/test/files/jvm/actor-uncaught-exception.scala +++ b/test/files/jvm/actor-uncaught-exception.scala @@ -43,6 +43,7 @@ object Test { Actor.loop { react { case Exit(actor, reason) => + println("OK") if (actor == StartError) MessageError ! 'ping else diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala index 626ce5da92..36b6f0c52e 100644 --- a/test/files/jvm/actor-uncaught-exception2.scala +++ b/test/files/jvm/actor-uncaught-exception2.scala @@ -58,7 +58,6 @@ object Test { } def main(args: Array[String]) { - Debug.level = 1 // decrease level so that it does not print warnings Supervisor.start() } } |