summaryrefslogtreecommitdiff
path: root/test/files/jvm/actor-exceptions.scala
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2010-04-22 08:04:12 +0000
committerPhilipp Haller <hallerp@gmail.com>2010-04-22 08:04:12 +0000
commitdcbffd4dc50c7e2540fd4770492b86108d3254fc (patch)
treeced3f0c9081b93fd07ff28bd2fcd7f5d0a436fb3 /test/files/jvm/actor-exceptions.scala
parent3861a3a42e4347c733a3c15a7cd85fa86d1d1011 (diff)
downloadscala-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/actor-exceptions.scala')
-rw-r--r--test/files/jvm/actor-exceptions.scala10
1 files changed, 7 insertions, 3 deletions
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()
}
}