MeltwaterArchive / datasift-java

Java client to interface with DataSift
http://www.datasift.com/
MIT License
10 stars 7 forks source link

JsonMappingException when using Historics #112

Closed dugjason closed 4 years ago

dugjason commented 7 years ago

After resolving issues #73, #108 and #109, this still seems to be an issue in v3.2.16 of the client (latest version at time of writing).

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token 
at [Source: {"id":"xxx","dpus":30,"availability":{"start":"1481500800","end":"1481587200","sources":{"tumblr":{"augmentations":[],"versions":["3"],"status":100}}}}; line: 1, column: 133] (through reference chain: com.datasift.client.historics.PreparedHistoricsQuery["availability"]->com.datasift.client.historics.Availability["sources"]->java.util.LinkedHashMap["tumblr"]->com.datasift.client.historics.Source["augmentations"]) 

When there are no augmentations the response is an empty array []. In the source code, Augmentations are represented as a Map<String, Integer> which is represented as {} in json notation. That is the cause of the error. Right now it is not possible to properly use this method in client