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

MINOR: Various cleanups in clients #17895

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

mimaison
Copy link
Member

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Contributor

@TaiJuWu TaiJuWu left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines -386 to -388
} catch (UnsupportedEncodingException e) {
// The world has gone crazy!
throw new IOException(String.format("Encoding %s not supported", StandardCharsets.UTF_8.name()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity, all linux distributions aleady support utf-8?

Copy link
Member Author

Choose a reason for hiding this comment

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

This exception can be thrown by URLEncoder.encode(String, String) when the 2nd argument is not a valid charset. Since Java 10, there's a new method encode(String, Charset). We can now use this new method and pass StandardCharsets.UTF_8, which is a Charset object directly instead of StandardCharsets.UTF_8.name which is a String. That way we are sure encode(String, Charset) won't throw UnsupportedEncodingException.

@chia7712
Copy link
Contributor

@mimaison please fix the conflicts, thanks !

@mimaison
Copy link
Member Author

Done! Thanks

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

Successfully merging this pull request may close these issues.

3 participants