-
Notifications
You must be signed in to change notification settings - Fork 38.5k
RequestMapping method returning Future with null result causes NullPointerException [SPR-16072] #20621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented Could you post a stacktrace of that NPE please? I have backported quite a few nullability refinements from 5.0 already, so I'm up for fixing this one as well... but it'd be great to know which of the many refinements in 5.0 actually addressed this issue here. |
martian commented https://travis-ci.org/zhanhb/future-null-pointer-exception |
Rossen Stoyanchev commented We support ListenableFuture and CompletableFuture since those can be adapted to a DeferredResult. The only way to support a plain Future is to call Based on the above stack trace my guess is that Future falls through the checks of all return value handlers and ends up being treated as a model attribute and that's most likely not intended (at least not as an unresolved Future). |
Juergen Hoeller commented From my perspective, the real bug here is that our return type check causes an NPE against such a Future handle with a null value. I intend to backport that part to 4.3.13 but won't change anything about actually supported return types. |
Rossen Stoyanchev commented Okay sounds good to me. I was just qualifying the expectations around what works. |
Juergen Hoeller commented This should be resolved in the upcoming Please note that, as per Rossen's comment, your |
martian commented I get NullPointerException with spring-core-4.3.13.BUILD-20171016.211232-3.jar |
Juergen Hoeller commented Indeed, this was missing overridden Please give the upcoming |
martian commented The test is passed now, thanks. |
martian opened SPR-16072 and commented
RequestMapping returns a Future with anytype generic parameter and async result is null leads to NullPointerException
It's fix with 5.0.0.RELEASE
Affects: 4.3.12
Reference URL: https://github.com/zhanhb/future-null-pointer-exception
Issue Links:
Referenced from: commits 6f65b63, c2438cb
The text was updated successfully, but these errors were encountered: