Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log.debug(json) fails with scala.MatchError (when I do not use explicit json.toString()) #4

Open
petervandenabeele opened this issue May 2, 2015 · 0 comments

Comments

@petervandenabeele
Copy link

This code:

import nl.typeset.sonofjson
import nl.typeset.sonofjson._
...
      val s: String = x.payload.decodeString("UTF-8")
      log.debug(s)

      val json = parse(s)
      log.debug(json.toString)
      log.debug(json) // <== This fails with scala.MatchError

generates the output below with the scala.MatchError.

I am not sure if that is expected, or I should be able to simply use the json as an argument for log.debug (without the explicit call to toString()).

[DEBUG] [05/02/2015 12:36:16.374] [UHttpTestSystem-akka.actor.default-dispatcher-6] [akka://UHttpTestSystem/user/$g/$a] {
  "foo": "bar"
}
[DEBUG] [05/02/2015 12:36:16.375] [UHttpTestSystem-akka.actor.default-dispatcher-6] [akka://UHttpTestSystem/user/$g/$a] JObject(Map(foo -> JString(bar)))
[ERROR] [05/02/2015 12:36:16.375] [UHttpTestSystem-akka.actor.default-dispatcher-6] [akka://UHttpTestSystem/user/$g/$a] JObject(Map(foo -> JString(bar))) (of class nl.typeset.sonofjson.package$JObject)
scala.MatchError: JObject(Map(foo -> JString(bar))) (of class nl.typeset.sonofjson.package$JObject)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:253)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:251)
    at nl.typeset.sonofjson.Implicits$$anonfun$5.applyOrElse(Implicits.scala:70)
    at nl.typeset.sonofjson.Implicits$$anonfun$5.applyOrElse(Implicits.scala:70)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
    at customer.server.CustomerSocketWorker$$anonfun$businessLogic$1.applyOrElse(CustomerSocketWorker.scala:37)
    at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:467)
    at spray.routing.HttpServiceActor.aroundReceive(HttpService.scala:96)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
    at akka.actor.ActorCell.invoke(ActorCell.scala:487)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)
    at akka.dispatch.Mailbox.run(Mailbox.scala:221)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant