thank you for this library, it saved me time and maintenance. I was just beginning to write the usual buffer/serialize code when I stumbled upon your code and was really happy that I could simplify things with it.
While I was testing the code, I came across the below issue:
Send a JSON to a server and make the server respond with corrupted JSON but still setting the content-type header to application/json. I just make the server send back the string "bad json". The expected result is that the future fails with the details of the parsing error, however this is not the case, instead the future is cancelled and the original failure is lost.
It seems that when failed is called, then HttpAsyncClient will make a call to releaseResources() before it sets the failure cause on the future. The problem is that AbstractJsonEntityConsumer calls cancel on the future from releaseResources() and then the future gets completed with a Cancellation preventing the real cause of the failure to bet set. So instead of the parsing error, I end up with a not too useful cancellation.
What is the reason for calling cancel from releaseResources()?
Hi Oleg,
thank you for this library, it saved me time and maintenance. I was just beginning to write the usual buffer/serialize code when I stumbled upon your code and was really happy that I could simplify things with it.
While I was testing the code, I came across the below issue:
Send a JSON to a server and make the server respond with corrupted JSON but still setting the content-type header to application/json. I just make the server send back the string "bad json". The expected result is that the future fails with the details of the parsing error, however this is not the case, instead the future is cancelled and the original failure is lost.
Here is the stack from IDEA:
It seems that when
failed
is called, then HttpAsyncClient will make a call toreleaseResources()
before it sets the failure cause on the future. The problem is thatAbstractJsonEntityConsumer
calls cancel on the future fromreleaseResources()
and then the future gets completed with a Cancellation preventing the real cause of the failure to bet set. So instead of the parsing error, I end up with a not too useful cancellation.What is the reason for calling
cancel
fromreleaseResources()
?