Polishing
This commit is contained in:
@@ -219,7 +219,7 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
||||
return readJavaType(javaType, inputMessage);
|
||||
}
|
||||
|
||||
private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) {
|
||||
private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) throws IOException {
|
||||
try {
|
||||
if (inputMessage instanceof MappingJacksonInputMessage) {
|
||||
Class<?> deserializationView = ((MappingJacksonInputMessage) inputMessage).getDeserializationView();
|
||||
@@ -230,8 +230,8 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
||||
}
|
||||
return this.objectMapper.readValue(inputMessage.getBody(), javaType);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new HttpMessageNotReadableException("Could not read JSON document: " + ex.getMessage(), ex);
|
||||
catch (JsonProcessingException ex) {
|
||||
throw new HttpMessageNotReadableException("JSON parse error: " + ex.getOriginalMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
|
||||
|
||||
}
|
||||
catch (JsonProcessingException ex) {
|
||||
throw new HttpMessageNotWritableException("Could not write JSON document: " + ex.getMessage(), ex);
|
||||
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getOriginalMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class GsonHttpMessageConverter extends AbstractGenericHttpMessageConverte
|
||||
return this.gson.fromJson(json, token.getType());
|
||||
}
|
||||
catch (JsonParseException ex) {
|
||||
throw new HttpMessageNotReadableException("Could not read JSON document: " + ex.getMessage(), ex);
|
||||
throw new HttpMessageNotReadableException("JSON parse error: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class GsonHttpMessageConverter extends AbstractGenericHttpMessageConverte
|
||||
writer.close();
|
||||
}
|
||||
catch (JsonIOException ex) {
|
||||
throw new HttpMessageNotWritableException("Could not write JSON document: " + ex.getMessage(), ex);
|
||||
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -86,7 +86,8 @@ public class HttpMessageConverterExtractor<T> implements ResponseExtractor<T> {
|
||||
|
||||
for (HttpMessageConverter<?> messageConverter : this.messageConverters) {
|
||||
if (messageConverter instanceof GenericHttpMessageConverter) {
|
||||
GenericHttpMessageConverter<?> genericMessageConverter = (GenericHttpMessageConverter<?>) messageConverter;
|
||||
GenericHttpMessageConverter<?> genericMessageConverter =
|
||||
(GenericHttpMessageConverter<?>) messageConverter;
|
||||
if (genericMessageConverter.canRead(this.responseType, null, contentType)) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Reading [" + this.responseType + "] as \"" +
|
||||
|
||||
Reference in New Issue
Block a user