Allow for either getOutputStream or getWriter to be used before sendRedirect is called#119
Draft
reversefold wants to merge 1 commit intojenkinsci:masterfrom
Draft
Allow for either getOutputStream or getWriter to be used before sendRedirect is called#119reversefold wants to merge 1 commit intojenkinsci:masterfrom
reversefold wants to merge 1 commit intojenkinsci:masterfrom
Conversation
d2ec085 to
9dca307
Compare
…edirect is called.
9dca307 to
bccccae
Compare
Member
|
Sounds right but can this be proven in a test? Is there a particular filed bug this is addressing? |
Author
|
This is related to a PR I wrote for the jenkins-artifactory-plugin: https://github.com/JFrogDev/jenkins-artifactory-plugin/pull/54/files Originally I was using getWriter() but I got a confusing error message about getWriter() already having been called. It took me a while to track down exactly what was going wrong and switch to getOutputStream(). This PR makes it so that either can be used before a redirect. |
Member
|
OK. Putting this on hold until I have a moment to figure out if this is amenable to unit testing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current code always calls getOutputStream() in sendRedirect, which makes the response fail if getWriter() is used in the calling code before sendRedirect() is called. This PR closes either the writer or output stream depending on which was used.
This change is