Skip to content
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

Exception reading from already closed stream #9

Open
cclulu opened this issue Oct 24, 2019 · 1 comment
Open

Exception reading from already closed stream #9

cclulu opened this issue Oct 24, 2019 · 1 comment

Comments

@cclulu
Copy link

cclulu commented Oct 24, 2019

Scenario:

Print Response? option checked and receive response code of >=400.

Expected Behavior:

Fail rundeck job with a Step exception.
The error we would be expecting is:
Error when sending request: {response body}

Actual behavior:

Fail rundeck job with a IOException
The actual error we are getting:
Error when sending request: Attempted read from closed stream.

Reason:

getPageContent function reads from the response entity, causing the second read, to fail because once read from, the stream lose the contents so it won't be able to be read from again.

Possible solution:

Is to set a body available to all of the try block, that way it could be read from once, and then the second read would just need to check if the body has been set already, if not read from the response.

@cclulu
Copy link
Author

cclulu commented Oct 24, 2019

I would like to do the pull request implementing this solution if this is seen as a reasonable solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant