You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.NullPointerException
at spray.json.PimpedAny.toJson(package.scala:40)
at spray.json.CollectionFormats$$anon$1$$anonfun$write$1.apply(CollectionFormats.scala:26)
at spray.json.CollectionFormats$$anon$1$$anonfun$write$1.apply(CollectionFormats.scala:26)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at spray.json.CollectionFormats$$anon$1.write(CollectionFormats.scala:26)
at spray.json.CollectionFormats$$anon$1.write(CollectionFormats.scala:25)
at spray.json.PimpedAny.toJson(package.scala:40)
at spray.json.StandardFormats$OptionFormat.write(StandardFormats.scala:34)
at spray.json.StandardFormats$OptionFormat.write(StandardFormats.scala:32)
at spray.json.ProductFormats$class.productElement2Field(ProductFormats.scala:473)
at spray.json.MyJsonProtocol$.productElement2Field(TestNPE.scala:5)
at spray.json.ProductFormats$$anon$1.write(ProductFormats.scala:32)
at spray.json.ProductFormats$$anon$1.write(ProductFormats.scala:30)
at spray.json.PimpedAny.toJson(package.scala:40)
at spray.json.TestNPE$.main(TestNPE.scala:18)
at spray.json.TestNPE.main(TestNPE.scala)
I tried to fix it myself but my knowledge of Scala is not strong enough yet. NPE happens here when it's attempting to convert inner TestItem. Function parameter write at that moment is null.
I don't know why it doesn't use my implicit instead.
The text was updated successfully, but these errors were encountered:
Perhaps I discovered a bug. I get Null Pointer Exception when I'm trying to get json of an object that has field of type of itself. Example is:
And call-stack is this
I tried to fix it myself but my knowledge of Scala is not strong enough yet. NPE happens here when it's attempting to convert inner
TestItem
. Function parameterwrite
at that moment isnull
.I don't know why it doesn't use my implicit instead.
The text was updated successfully, but these errors were encountered: