Bug in JSON extraction under Scala 2.9.1 #1169

Closed
jorgeortiz85 opened this Issue Dec 21, 2011 · 3 comments

Projects

None yet

4 participants

@jorgeortiz85
Member

Under Scala 2.9.1, extracting JSON to some case classes fails when it succeeded under 2.8.1.

I suspect this may be due to a change in the scalap libraries.

The attached file works when run under Scala 2.8.1 and Lift 2.4-M5. When run under Scala 2.9.1 and Lift 2.4-M5, however, it produces the following exception:

net.liftweb.json.MappingException: unknown error
    at net.liftweb.json.Extraction$.extract(Extraction.scala:45)
    at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:300)
    at ExtractBug$.main(ExtractBug.scala:11)
    at ExtractBug.main(ExtractBug.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
Caused by: java.lang.IndexOutOfBoundsException: 1
    at scala.collection.LinearSeqOptimized$class.apply(LinearSeqOptimized.scala:51)
    at scala.collection.immutable.List.apply(List.scala:45)
    at net.liftweb.json.ScalaSigReader$.findPrimitive$1(ScalaSig.scala:69)
    at net.liftweb.json.ScalaSigReader$.findArgType(ScalaSig.scala:75)
    at net.liftweb.json.ScalaSigReader$.readConstructor(ScalaSig.scala:26)
    at net.liftweb.json.Meta$Reflection$.term$1(Meta.scala:275)
    at net.liftweb.json.Meta$Reflection$.typeParameters(Meta.scala:293)
    at net.liftweb.json.Meta$.mkContainer$1(Meta.scala:107)
    at net.liftweb.json.Meta$.fieldMapping$1(Meta.scala:136)
    at net.liftweb.json.Meta$.mkContainer$1(Meta.scala:106)
    at net.liftweb.json.Meta$.fieldMapping$1(Meta.scala:138)
    at net.liftweb.json.Meta$.toArg$1(Meta.scala:154)
    at net.liftweb.json.Meta$$anonfun$constructors$1$1$$anonfun$apply$1.apply(Meta.scala:98)
    at net.liftweb.json.Meta$$anonfun$constructors$1$1$$anonfun$apply$1.apply(Meta.scala:97)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at net.liftweb.json.Meta$$anonfun$constructors$1$1.apply(Meta.scala:97)
    at net.liftweb.json.Meta$$anonfun$constructors$1$1.apply(Meta.scala:96)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at net.liftweb.json.Meta$.constructors$1(Meta.scala:96)
    at net.liftweb.json.Meta$$anonfun$mappingOf$1.apply(Meta.scala:168)
    at net.liftweb.json.Meta$$anonfun$mappingOf$1.apply(Meta.scala:160)
    at net.liftweb.json.Meta$Memo.memoize(Meta.scala:197)
    at net.liftweb.json.Meta$.mappingOf(Meta.scala:160)
    at net.liftweb.json.Extraction$.mkMapping$1(Extraction.scala:193)
    at net.liftweb.json.Extraction$.net$liftweb$json$Extraction$$extract0(Extraction.scala:198)
    at net.liftweb.json.Extraction$.extract(Extraction.scala:42)
    at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:300)
    at ExtractBug$.main(ExtractBug.scala:11)
    at ExtractBug.main(ExtractBug.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

@pbrant pbrant pushed a commit to pbrant/framework that referenced this issue May 8, 2012
Joni Freeman Workaround for issue #1169 42ca1b1
@Shadowfiend
Member

@pbrant looks like a fix for this has been in your repo since 2.5.1; is it also in the main Lift distribution or…?

@farmdawgnation
Member

The code in the aforementioned commit is in the main Lift distribution. So I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment