Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not construct instance of java.util.ArrayList: no String-argument constructor/factory method to deserialize from String value ('')
at [Source: java.io.PushbackInputStream@22d9d; line: 1, column: 1185] (through reference chain: NYTimes.Payload.Headline["results"]->java.util.ArrayList[0]->NYTimes.Story.Story["multimedia"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.util.ArrayList: no String-argument constructor/factory method to deserialize from String value ('')
at [Source: java.io.PushbackInputStream@22d9d; line: 1, column: 1185] (through reference chain: NYTimes.Payload.Headline["results"]->java.util.ArrayList[0]->NYTimes.Story.Story["multimedia"])
Я пытался понять, почему он не десериализуется. если строковое значение пусто, то в результате должен получиться нулевой список?
[code]RestTemplate restTemplate = new RestTemplate(); MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); jsonConverter.setSupportedMediaTypes(Arrays.asList(new MediaType("text","json",MappingJackson2HttpMessageConverter.DEFAULT_CHARSET))); restTemplate.getMessageConverters().add(jsonConverter); Headline headline = restTemplate.getForObject("http://abc/svc/topstories/v1/home.json?api-key=key",Headline.class); logger.info("Headline"+headline.toString()); [/code]
Исключение, которое я получаю при звонке:
[code]Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not construct instance of java.util.ArrayList: no String-argument constructor/factory method to deserialize from String value ('') at [Source: java.io.PushbackInputStream@22d9d; line: 1, column: 1185] (through reference chain: NYTimes.Payload.Headline["results"]->java.util.ArrayList[0]->NYTimes.Story.Story["multimedia"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.util.ArrayList: no String-argument constructor/factory method to deserialize from String value ('') at [Source: java.io.PushbackInputStream@22d9d; line: 1, column: 1185] (through reference chain: NYTimes.Payload.Headline["results"]->java.util.ArrayList[0]->NYTimes.Story.Story["multimedia"]) [/code]
Я пытался понять, почему он не десериализуется. если строковое значение пусто, то в результате должен получиться нулевой список?