Skip to content
This repository has been archived by the owner on May 21, 2018. It is now read-only.

Retrieving values from JsonBuffer does not work in 2.0.0-M7 #237

Open
oleg-py opened this issue Aug 25, 2016 · 0 comments
Open

Retrieving values from JsonBuffer does not work in 2.0.0-M7 #237

oleg-py opened this issue Aug 25, 2016 · 0 comments
Labels

Comments

@oleg-py
Copy link

oleg-py commented Aug 25, 2016

Rapture 2.0.0-M7, Scala 2.11.8

Was doing some json-based storage for a little project and found that this innocent code:

object JsonBufferError extends App {
  import rapture.json._
  import jsonBackends.jawn._
  JsonBuffer.parse("""{"counter": 1}""").as[Json].counter.as[Long] // <-- this line works ok
  JsonBuffer.parse("""{"counter": 1}""").counter.as[Long] // <-- this line fails
}

Exception being:

Exception in thread "main" rapture.data.TypeMismatchException: type mismatch: Expected number but found object
    at rapture.json.jsonBackends.jawn.JawnAst$.getBigDecimal(ast.scala:68)
    at rapture.json.Extractors_1$$anon$6$$anonfun$extract$6.apply(extractors.scala:100)
    at rapture.json.Extractors_1$$anon$6$$anonfun$extract$6.apply(extractors.scala:100)
    at rapture.core.ThrowExceptionsMode.wrap(modes.scala:200)
    at rapture.json.Extractors_1$$anon$6.extract(extractors.scala:100)
    at rapture.json.Extractors_1$$anon$6.extract(extractors.scala:95)
    at rapture.data.Extractor$$anon$7$$anonfun$extract$7$$anonfun$apply$8.apply(extractors.scala:140)
    at rapture.core.ThrowExceptionsMode.unwrap(modes.scala:201)
    at rapture.data.Extractor$$anon$7$$anonfun$extract$7.apply(extractors.scala:140)
    at rapture.core.ThrowExceptionsMode.wrap(modes.scala:200)
    at rapture.data.Extractor$$anon$7.extract(extractors.scala:140)
    at rapture.data.Extractor$$anon$7$$anonfun$extract$7$$anonfun$apply$8.apply(extractors.scala:140)
    at rapture.core.ThrowExceptionsMode.unwrap(modes.scala:201)
    at rapture.data.Extractor$$anon$7$$anonfun$extract$7.apply(extractors.scala:140)
    at rapture.core.ThrowExceptionsMode.wrap(modes.scala:200)
    at rapture.data.Extractor$$anon$7.extract(extractors.scala:140)
    at rapture.json.Extractors_2$$anon$7.extract(extractors.scala:124)
    at rapture.json.Extractors_2$$anon$7.extract(extractors.scala:121)
    at rapture.data.DataType$class.as(data.scala:256)
    at rapture.json.JsonBuffer.as(json.scala:177)
    at JsonBufferError$.delayedEndpoint$JsonBufferError$1(JsonBufferError.scala:5)
    at JsonBufferError$delayedInit$body.apply(JsonBufferError.scala:1)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.App$class.main(App.scala:76)
    at JsonBufferError$.main(JsonBufferError.scala:1)
    at JsonBufferError.main(JsonBufferError.scala)
    ...
@mielientiev mielientiev added this to the 2.0.0-M9 Mixtec milestone Jan 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants