Tag: idml

JsonMappingException(是java.lang.NullPointerException)

我一直在寻找这个问题但是没有找到任何答案,所以要么我错过了一些如此明显的东西没有人写过任何关于它的东西,或者我遇到了一个不寻常的问题。 我希望这是第一次…… 我正在使用第三方库( IDMLlib )从以.idml格式存储的Adobe InDesign文档中提取信息。 内容很容易读取并存储在“Idml”类型的对象中,其中包含我需要的所有内容。 现在,我想使用Jackson JSON将此对象发送到Web客户端(浏览器)。 我遇到了两个问题: 1)对象树充满了圆形的引用。 我通过使用带有注释的Mix-ins来解决这个问题 @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = “@id”) 所以现在我已经准备好了很多Mix-ins,如果问题2需要的话。 2)序列化时我不断收到新的特定于对象的错误。 –Output from testMethodsReturnsSomething– | Failure: testMethods(package.IdmlServiceTests) | com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: de.fhcon.idmllib.api.elements.Idml[“document”]->de.fhcon.idmllib.api.elements.Document[“tags”]->de.fhcon.idmllib.api.elements.tags.Tags[“xmltagList”]->java.util.ArrayList[0]->de.fhcon.idmllib.api.elements.tags.XMLTag[“tagColor”]->de.fhcon.idmllib.api.elements.typedefs.InDesignUIColorType[“greenValue”]) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:218) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:183) at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:155) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:533) … 我已经尝试编写自定义NullValue / NullKey序列化程序,但这对NullPointerException没有帮助。 我可以在我的Mix-ins中使用注释来处理这个问题吗? 还是有另一种方法让我序列化这个对象?