-
Notifications
You must be signed in to change notification settings - Fork 351
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
Jersey Client - Response status code ignored if server closes connection #4003
Comments
Sounds like we could do something about it. A reproducer would help us. |
Thanks @jansupol Here is a test that runs into this issue - https://gist.github.com/sumitkdey/7cff1bb70d9d9a5dc2570b2f7146d2e2/2d1fdfa6e382324e5e1c4ff27b63406e53517749. Currently the test fails with an IOException error. It would be useful for the caller if instead of the exception, the failure status code could be returned in the response. |
@jansupol any updates on this issue? |
This would be a great fix. This status code is lost in Jersey where it simply raises a ProcessingException(-1) instead. |
Hi @jansupol - is there any update on this issue? I am hitting it and a fix would be great. Thanks. |
Hi @jansupol - could you please let us know when this may be fixed? Also, if there is a workaround in the short time frame. Thanks. |
The exception thrown is an exception and I do not think we can consume it and return the response instead, we need to let the user know that the exception has been thrown. What we can do, we can throw |
@sumitkdey Thanks for the reproducer, really helped. |
Hello,
If during a PUT call, the web server responds with the error status code and closes the connection (before the client finishes streaming all the data), jersey client raises an IOException and ignores the status code returned by the server.
Going through the code, it seems that the IOException is raised from line 360 before the response status code is read in line 366.
jersey/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnector.java
Lines 359 to 369 in 0cfff66
In case the response status code is available, returning that would be more valuable to the caller than the IOException in this case.
The text was updated successfully, but these errors were encountered: