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
HttpEntity parameter 'null' in method (regression) [SPR-12287] #16892
Comments
Rossen Stoyanchev commented This is likely a side effect of commit a9b2a1. Is it a case of the controller returning an HttpEntity with a null body? Can you confirm the controller method signature? |
David Harrigan commented Hi Rossen, Thank you for your prompt reply. The controller method signature that is being invoked is this:
Unfortunately, I have a If I can be of any further assistance, please do let me know. -=david=- |
Rossen Stoyanchev commented Okay thanks, that should be enough to reproduce the issue. |
Rossen Stoyanchev commented David Harrigan I tried using the above method signature but wasn't able to reproduce the issue. Please take a look at the sample project https://github.com/spring-projects/spring-framework-issues/tree/master/SPR-12287 I created. |
David Harrigan commented Hi Rossen, Thank you for the update. I've reconfirmed on my side that this update to 4.1.1 breaks still. The POSTs still cause this exception - GETs seem to be okay. I will attempt to see if I can figure out on my side anything that may be of use. I had a look at your test app, but not had a chance to run it. FYI, this is the stack I've just seen:
|
David Harrigan commented Hi Rossen, I've done some more playing around. If I change my type signature to simply return a String it works fine
You know, you're probably going to shoot me! but it would have been very helpful to you if I included the annotations in my reply to your request for an example above. Perhapt it may help. One thing I'm doing is that I have an advice being actioned:
So, it appears that any composite object (i.e., Callable<ResponseEntity<Void>>) is always throwing an exception for me as above, whereas simple return types, such as Callable<Employee> works successfully. I hope that helps a bit more. -=david=- |
Rossen Stoyanchev commented Never mind, I got it reproduced. Thanks. |
David Harrigan commented Really! That's amazing. I've just cloned the #16892 repo, added in jackson and the JSON view resolver, and was trying to get it to fail like on my application - couldn't do it - I was about to break down in tears :-) :-) What's the issue? Totally curious! :-) -=david=- |
Rossen Stoyanchev commented I pushed the changes I made. The key part is actually using 4.1.1 :) The issue is related to the use of Callable<ResponseEntity<?>> where the ResponseEntity has no body. It has trouble extracting the parameterized type from the method signature in this specific scenario. Previously it worked because we didn't try to go any further if the body was null. #16766 in 4.1.1 changed that. Hence the issue. |
David Harrigan commented w00t! I look forward to Spring 4.1.2! :-) -=david=- |
Rossen Stoyanchev commented This should be fixed now with commit 956b66. If you can please give it a try with 4.1.2.BUILD-SNAPSHOT after this build is completed https://build.spring.io/browse/SPR-PUB-1781. |
David Harrigan commented Hi, Tested with 4.1.2.BUILD-SNAPSHOT and I'm happy to report that the error, as reported, is not happening anymore :-) Thanks Rossen! -=david=- |
Rossen Stoyanchev commented Great, thanks for verifying! |
Marcel Overdijk commented I'm seeing a similar issue in 4.1.1. I tested today with 4.1.2.BUILD-SNAPSHOT but still get the problem. The case I have is I have a custom ResponseEntityExceptionHandler like:
I'm using Spring's Test MvcMock framework to test but in case I the ResourceNotFoundException is thrown from my controller I get the same exception:
Should I create a separate issue for this? |
Rossen Stoyanchev commented No it's fine to keep it under this report. It looks like in this example the ResponseEntity is declared as a raw type without a generic parameter. |
Marcel Overdijk commented Yes that's indeed the case:
Note that I do this on purpose to be able to return different objects based on what happens in the controller. I assume using a raw ResponseEntity type should be supported, right? |
Rossen Stoyanchev commented This should be fixed now with commit c5e360. |
Marcel Overdijk commented Thx Rossen, I can confirm this is now fixed with 4.1.2.BUILD-20141017.172150-32 |
Rossen Stoyanchev commented Thanks for confirming! |
David Harrigan opened SPR-12287 and commented
Hi,
Linux
Java 1.8.0_20
Just upgraded to Spring 4.1.1 (was using Spring 4.1.0 prior). I'm now receiving this error on a controller that is working for 4.1.0.
I'm going to have to revert back to 4.1.0.
Thank you
-=david=-
Affects: 4.1.1
Issue Links:
Referenced from: commits c5e360d, 8cce404, 956b66b
0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: