Leniently accept custom DeferredResult etc subclasses for null values

Issue: SPR-14423
(cherry picked from commit cfc560c)
This commit is contained in:
Juergen Hoeller
2016-07-02 12:55:30 +02:00
parent 3d106eb655
commit 4ddd9572f7
3 changed files with 81 additions and 38 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -263,16 +263,10 @@ public class ServletInvocableHandlerMethod extends InvocableHandlerMethod {
if (this.returnValue != null) {
return this.returnValue.getClass();
}
Class<?> parameterType = super.getParameterType();
if (ResponseBodyEmitter.class.isAssignableFrom(parameterType) ||
StreamingResponseBody.class.isAssignableFrom(parameterType)) {
return parameterType;
if (!ResolvableType.NONE.equals(this.returnType)) {
return this.returnType.getRawClass();
}
if (ResolvableType.NONE.equals(this.returnType)) {
throw new IllegalArgumentException("Expected one of Callable, DeferredResult, or ListenableFuture: " +
super.getParameterType());
}
return this.returnType.getRawClass();
return super.getParameterType();
}
@Override