-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Not an issue. Just noticed while digging through the implementation: Looks like the ResourceHttpMessageConverter can construct a value that doesn't implement the requested type if that type extends the non-final ByteArrayResource type.
Lines 96 to 104 in 2691489
| else if (Resource.class == clazz || ByteArrayResource.class.isAssignableFrom(clazz)) { | |
| byte[] body = StreamUtils.copyToByteArray(inputMessage.getBody()); | |
| return new ByteArrayResource(body) { | |
| @Override | |
| public @Nullable String getFilename() { | |
| return inputMessage.getHeaders().getContentDisposition().getFilename(); | |
| } | |
| }; | |
| } |
the condition should probably be
else if (Resource.class == clazz || clazz.isAssignableFrom(ByteArrayResource.class)) { which I guess could then be simplified to
else if (clazz.isAssignableFrom(ByteArrayResource.class)) { (but maybe this simplification would be a de-optimization if clazz == Resource.class is a common case).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement