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

response#getWriter should throw UnsupportedEncodingException in case of bad character encoding used #9037

Merged

Conversation

olamy
Copy link
Member

@olamy olamy commented Dec 12, 2022

TCK issue

response.setCharacterEncoding("allez-les-bleus");
then 
response.getWriter(); 

According to TCK and servlet api this should throws UnsupportedEncodingException
but actually EncodingHttpWriter catch it then wrap it in new RuntimeException

@gregw I was not sure how to fix that.
I would have preferred to change the constructor (to avoid such catch and instanceof block
public EncodingHttpWriter(HttpOutput out, String encoding)
to
public EncodingHttpWriter(HttpOutput out, String encoding) throws IOException

Signed-off-by: Olivier Lamy [email protected]

…of bad character encoding used

Signed-off-by: Olivier Lamy <[email protected]>
@olamy olamy added the TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc) label Dec 12, 2022
@gregw
Copy link
Contributor

gregw commented Dec 12, 2022

@olamy changing constructor to throw is fine. It is only used in 1 place.

@olamy olamy requested a review from gregw December 12, 2022 07:18
Signed-off-by: Olivier Lamy <[email protected]>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@olamy olamy merged commit 139d3f2 into jetty-12.0.x Dec 12, 2022
@olamy olamy deleted the jetty-12.0.x-get-writer-unsupported-encoding-exception branch December 12, 2022 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants