From c2bfb4c0c66c9a65bd985baaf9495a6dff4bb04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bon=C3=A9r?= Date: Mon, 22 Mar 2010 00:01:46 +0100 Subject: [PATCH] fixed bug in REST module --- akka-rest/src/main/scala/ActorComponentProvider.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/akka-rest/src/main/scala/ActorComponentProvider.scala b/akka-rest/src/main/scala/ActorComponentProvider.scala index c1d8029425..ed51482604 100644 --- a/akka-rest/src/main/scala/ActorComponentProvider.scala +++ b/akka-rest/src/main/scala/ActorComponentProvider.scala @@ -16,16 +16,14 @@ class ActorComponentProvider(val clazz: Class[_], val configurators: List[Config override def getScope = ComponentScope.Singleton - override def getInstance: Actor = { + override def getInstance: AnyRef = { val instances = for { conf <- configurators if conf.isDefined(clazz) instance <- conf.getInstance(clazz) } yield instance - instances match { - case (instance : Actor) :: Nil => instance - case Nil => throw new IllegalArgumentException("No Actor for class [" + clazz + "] could be found. Make sure you have defined and configured the class as an Active Object or Actor in a Configurator") - case _ => throw new IllegalArgumentException("Actor for class [" + clazz + "] is defined in more than one Configurator. Eliminate the redundancy.") - } + if (instances.isEmpty) throw new IllegalArgumentException( + "No Actor or Active Object for class [" + clazz + "] could be found.\nMake sure you have defined and configured the class as an Active Object or Actor in a supervisor hierarchy.") + else instances.head.asInstanceOf[AnyRef] } } \ No newline at end of file