-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Using the attached JSON file, Jackson 2.2.2, and the following code, I see the error:
Exception in thread "main" java.lang.IllegalStateException: Could not resolve Object Id [544068%2FTaxonomicItem] (for [simple type, class rnrm.RNRMDot$ReferenceThingTemplate]) -- unresolved forward-reference?
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectId(BeanDeserializerBase.java:962)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1041)
object RNRMDot {
def main(args: Array[String]) {
val mapper = new ObjectMapper() with ScalaObjectMapper
mapper.registerModule(DefaultScalaModule)
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
val roots = mapper.readValue[Array[ReferenceThingTemplate]](new FileInputStream(args(0)))
System.out.println(roots(0).uri)
}
@JsonIdentityInfo(generator = classOf[ObjectIdGenerators.PropertyGenerator], property = "uri")
case class ReferenceThingTemplate(
uri:String,
children:Array[ReferenceThingTemplate],
edgeKinds:Array[String],
hasChildren:Boolean,
displayLabel:String,
comment:String,
id:Int
) { }
}
544068 is a top level object that is later referenced in an array in a child (I've also attached a screenshot that makes this easier to see). The id field appears early in the data, just after the _type field) and before any children objects. This seems like it should be valid, and we have client side code that parses it using a map. This seems simliar to issue 97 but the presence of the id field early in the data seems to distinguish it.
Metadata
Metadata
Assignees
Labels
No labels