杰克逊意外的输入结束例外

时间:2015-04-20 09:40:27

标签: json jackson

我的在线申请中有一个非常奇怪的例外,尽管杰克逊很少。我仍然无法弄清楚原因是什么,正如我之前所说,它很少发生。

Stackoverflow中有关于这种性质的例外的类似帖子,但关于expecting closing '"'

没有任何内容

如果某人已经遇到过这样的错误,或者了解更多相关信息,我将非常感谢您能提供一些反馈意见,提前谢谢!
这是堆栈跟踪:

TRACE - Fri Apr 10 11:22:52 BST 2015: ApsDataRetriever: Finished fetching Aps to populate the Aps screen with 0 aps returned
org.codehaus.jackson.JsonParseException: Unexpected end-of-input: was expecting closing '"' for name
at Source: java.io.StringReader@7a55f3b4; line: 1, column: 4003703
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportInvalidEOF(JsonParserMinimalBase.java:454)
at org.codehaus.jackson.impl.ReaderBasedParser._parseFieldName2(ReaderBasedParser.java:1025)
at org.codehaus.jackson.impl.ReaderBasedParser._parseFieldName(ReaderBasedParser.java:1008)
at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:418)
..........
..........

这是应用程序中使用的典型JSON对象:

 {"xxxxxxxxIdentifier":{"xxxxxn":"XXX","xxxxxyNumber":"XXX/10247946","xxxxxactNumber":"T2/99833261","xxxxxxxxIdentifier":"XXX|XXX/10247946|T2/99833261","validxxxxxxxxIdentifier":true},"t2xxxxxxxxxxxeverity":"E","xxxxxei":"353705068167888","pxxxxxNumber":"XXX/10247946","contractNumber":"T2/99833261","xxxxxyHolderSurname":"Activatorius","policyHolderFirstName":"Forcilius","postcode":"W12 8RJ","vexxxxxReg":"J410H","xxxxxlexxxxxndModel":"Mercedes,SLK 500","postxxxxxVehiclexxxxxs":{"xxxxx":0.0,"distanceFromxxxxx":0.0,"xxxxxceFromxxxxxddress":0.0,"roadName":"","acceleration":0.0,"engineState":"UNKNOWN","xxxxxlexxxxxg":false,"dataOK":false},"eventNumber":"AL325","origin":"XXX","timestamp":1427466384000,"timestampclosed":0,"customerLastContactedTimestamp":0,"lat":51.34164810180664,"lon":-0.25955501198768616,"activeUser":"","timestampActiveUser":0,"assignedUser":"System","timestampAssignedUser":1427466384000,"xxxxxStatus":"COLLECTINGDATA","xxxxxType":"xxxxx","xxxxxHistory":[{"user":"T2","date":1427466864923,"detail":"xxxxx created"}],"xxxxxCustomerContactHistory":{"date":0,"contactReason":null,"contactOutcome":null},"maximumG":7.25,"speed":0.0,"notesList":[],"boxxxxxxId":"353705068167888|AL325","needMoreData":true,"needMoreDataAttempts":0,"boxInAnomaly":false,"crn":null,"pk":"AL325"}

1 个答案:

答案 0 :(得分:3)

看起来你使用的是Jackson 1.x版本,所以如果版本很旧(例如1.6之前),这可能是一个错误。至少,我会尽可能升级到最近的1.x(最新的补丁,适用于你首先出现的任何次要版本;或者可能是1.9.13)。

否则此问题很可能是由于系统中的其他内容截断输入:例如,写入响应中间的服务器端超时可能导致此问题(取决于异常处理的完成方式)。 Parser简单地指出,在读取字段名称的过程中,没有更多的输入可用,并抛出异常。