use of kotlinx.serialization.SerializationException in project spring-framework by spring-projects.
the class KotlinSerializationJsonHttpMessageConverter method decode.
private Object decode(KSerializer<Object> serializer, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
MediaType contentType = inputMessage.getHeaders().getContentType();
String jsonText = StreamUtils.copyToString(inputMessage.getBody(), getCharsetToUse(contentType));
try {
// TODO Use stream based API when available
return this.json.decodeFromString(serializer, jsonText);
} catch (SerializationException ex) {
throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex, inputMessage);
}
}
Aggregations