Consistent throwing of HttpMessageNotReadableException vs IOException

Includes specific fine-tuning of ProtobufHttpMessageConverter and JAXB2 based message converters, as well as revised javadoc for abstract base classes.

Issue: SPR-16995
This commit is contained in:
Juergen Hoeller
2018-07-02 22:37:29 +02:00
parent 779cf8d240
commit d08b72a75a
10 changed files with 89 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -95,7 +95,7 @@ public class ResourceHttpMessageConverterTests {
public void shouldNotReadInputStreamResource() throws IOException {
ResourceHttpMessageConverter noStreamConverter = new ResourceHttpMessageConverter(false);
try (InputStream body = getClass().getResourceAsStream("logo.jpg") ) {
this.thrown.expect(IllegalStateException.class);
this.thrown.expect(HttpMessageNotReadableException.class);
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
inputMessage.getHeaders().setContentType(MediaType.IMAGE_JPEG);
noStreamConverter.read(InputStreamResource.class, inputMessage);