diff --git a/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala index 2fac82ab20..8838af1e6b 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala @@ -59,7 +59,7 @@ class AskSpec extends AkkaSpec { implicit val timeout = Timeout(0 seconds) val echo = system.actorOf(Props(new Actor { def receive = { case x ⇒ sender() ! x } })) val f = echo ? "foo" - val expectedMsg = "Timeout length must not be negative, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo + val expectedMsg = "Timeout length must be positive, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo intercept[IllegalArgumentException] { Await.result(f, timeout.duration) }.getMessage should ===(expectedMsg) @@ -69,7 +69,7 @@ class AskSpec extends AkkaSpec { implicit val timeout = Timeout(-1000 seconds) val echo = system.actorOf(Props(new Actor { def receive = { case x ⇒ sender() ! x } })) val f = echo ? "foo" - val expectedMsg = "Timeout length must not be negative, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo + val expectedMsg = "Timeout length must be positive, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo intercept[IllegalArgumentException] { Await.result(f, timeout.duration) }.getMessage should ===(expectedMsg) diff --git a/akka-actor/src/main/scala/akka/pattern/AskSupport.scala b/akka-actor/src/main/scala/akka/pattern/AskSupport.scala index 63484ece5c..5e819c7214 100644 --- a/akka-actor/src/main/scala/akka/pattern/AskSupport.scala +++ b/akka-actor/src/main/scala/akka/pattern/AskSupport.scala @@ -289,7 +289,7 @@ final class AskableActorRef(val actorRef: ActorRef) extends AnyVal { Future.failed[Any](new AskTimeoutException(s"""Recipient[$actorRef] had already been terminated. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) case ref: InternalActorRef ⇒ if (timeout.duration.length <= 0) - Future.failed[Any](new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) + Future.failed[Any](new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) else { val a = PromiseActorRef(ref.provider, timeout, targetName = actorRef, message.getClass.getName, sender) actorRef.tell(message, a) @@ -322,7 +322,7 @@ final class ExplicitlyAskableActorRef(val actorRef: ActorRef) extends AnyVal { case ref: InternalActorRef ⇒ if (timeout.duration.length <= 0) { val message = messageFactory(ref.provider.deadLetters) - Future.failed[Any](new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) + Future.failed[Any](new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorRef]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) } else { val a = PromiseActorRef(ref.provider, timeout, targetName = actorRef, "unknown", sender) val message = messageFactory(a) @@ -382,7 +382,7 @@ final class AskableActorSelection(val actorSel: ActorSelection) extends AnyVal { case ref: InternalActorRef ⇒ if (timeout.duration.length <= 0) Future.failed[Any]( - new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) + new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) else { val a = PromiseActorRef(ref.provider, timeout, targetName = actorSel, message.getClass.getName, sender) actorSel.tell(message, a) @@ -411,7 +411,7 @@ final class ExplicitlyAskableActorSelection(val actorSel: ActorSelection) extend if (timeout.duration.length <= 0) { val message = messageFactory(ref.provider.deadLetters) Future.failed[Any]( - new IllegalArgumentException(s"""Timeout length must not be negative, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) + new IllegalArgumentException(s"""Timeout length must be positive, question not sent to [$actorSel]. Sender[$sender] sent the message of type "${message.getClass.getName}".""")) } else { val a = PromiseActorRef(ref.provider, timeout, targetName = actorSel, "unknown", sender) val message = messageFactory(a) diff --git a/akka-typed/src/main/scala/akka/typed/Ask.scala b/akka-typed/src/main/scala/akka/typed/Ask.scala index 458410de70..f63bc50966 100644 --- a/akka-typed/src/main/scala/akka/typed/Ask.scala +++ b/akka-typed/src/main/scala/akka/typed/Ask.scala @@ -42,7 +42,7 @@ object AskPattern { case ref: InternalActorRef ⇒ if (timeout.duration.length <= 0) (ActorRef[U](ref.provider.deadLetters), - Future.failed[U](new IllegalArgumentException(s"Timeout length must not be negative, question not sent to [$actorRef]"))) + Future.failed[U](new IllegalArgumentException(s"Timeout length must be positive, question not sent to [$actorRef]"))) else { val a = PromiseActorRef(ref.provider, timeout, actorRef, "unknown") val b = ActorRef[U](a)