Nullability fine-tuning and related polishing

Issue: SPR-15720
This commit is contained in:
Juergen Hoeller
2017-07-13 21:20:42 +02:00
parent f46520e6e8
commit 301e2ea493
7 changed files with 255 additions and 237 deletions

View File

@@ -119,7 +119,6 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
/**
* Return the underlying {@code ObjectMapper} for this view.
*/
@Nullable
public ObjectMapper getObjectMapper() {
return this.objectMapper;
}

View File

@@ -167,7 +167,8 @@ public class Jaxb2CollectionHttpMessageConverter<T extends Collection>
return result;
}
catch (UnmarshalException ex) {
throw new HttpMessageNotReadableException("Could not unmarshal to [" + elementClass + "]: " + ex.getMessage(), ex);
throw new HttpMessageNotReadableException(
"Could not unmarshal to [" + elementClass + "]: " + ex.getMessage(), ex);
}
catch (JAXBException ex) {
throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);

View File

@@ -54,9 +54,8 @@ import org.springframework.util.ClassUtils;
* {@link XmlType}, and write classes annotated with {@link XmlRootElement},
* or subclasses thereof.
*
* <p>Note that if using Spring's Marshaller/Unmarshaller abstractions from the
* {@code spring-oxm} module you should can the
* {@link MarshallingHttpMessageConverter} instead.
* <p>Note: When using Spring's Marshaller/Unmarshaller abstractions from {@code spring-oxm},
* you should use the {@link MarshallingHttpMessageConverter} instead.
*
* @author Arjen Poutsma
* @author Sebastien Deleuze
@@ -140,8 +139,7 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa
catch (NullPointerException ex) {
if (!isSupportDtd()) {
throw new HttpMessageNotReadableException("NPE while unmarshalling. " +
"This can happen on JDK 1.6 due to the presence of DTD " +
"declarations, which are disabled.", ex);
"This can happen due to the presence of DTD declarations which are disabled.", ex);
}
throw ex;
}
@@ -202,11 +200,7 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa
}
private static final EntityResolver NO_OP_ENTITY_RESOLVER = new EntityResolver() {
@Override
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(new StringReader(""));
}
};
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
(publicId, systemId) -> new InputSource(new StringReader(""));
}