-
Notifications
You must be signed in to change notification settings - Fork 14k
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
base: trunk
Are you sure you want to change the base?
Conversation
3aa4100
to
db11286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} catch (UnsupportedEncodingException e) { | ||
// The world has gone crazy! | ||
throw new IOException(String.format("Encoding %s not supported", StandardCharsets.UTF_8.name())); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your explanation!
@mimaison please fix the conflicts, thanks ! |
db11286
to
5cb4206
Compare
Done! Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mimaison thanks for your patch. one small suggestion is left
@@ -17,7 +17,6 @@ | |||
|
|||
package org.apache.kafka.common.requests; | |||
|
|||
import org.apache.kafka.clients.admin.ConfigEntry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is interesting. we have two almost same ConfigEntry
... org.apache.kafka.clients.admin.ConfigEntry
and org.apache.kafka.common.requests.DescribeConfigsResponse.ConfigEntry
tmp.put(SaslConfigs.SASL_JAAS_CONFIG, new Password(jaasConfigText)); | ||
CONFIGS = Collections.unmodifiableMap(tmp); | ||
} | ||
private static final Map<String, ?> CONFIGS = Map.<String, Object>of(SaslConfigs.SASL_JAAS_CONFIG, new Password(JAAS_CONFIG_TEXT)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need <String, Object>
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that's not needed. Removed
Committer Checklist (excluded from commit message)