-
Notifications
You must be signed in to change notification settings - Fork 14.3k
KAFKA-19137: Use StandardCharsets.UTF_8
instead of StandardCharsets.UTF_8.name()
#19464
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
Conversation
@xijiu could you please merge trunk to run CI again? |
Yeah, I have merged it, PTAL |
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.
Overall LGTM. Leave a minor comment.
} | ||
String encodedSource = encodePath(sourceAndTarget.source()); | ||
String encodedTarget = encodePath(sourceAndTarget.target()); | ||
List<String> restNamespace = Arrays.asList(encodedSource, encodedTarget); |
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.
nit: Use List.of
.
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 @xijiu for this patch, left some comments
final ProcessorSupplier<String, Integer, Void, Void> supplier = new PrintedInternal<>(sysOutPrinter).build("processor"); | ||
final Processor<String, Integer, Void, Void> processor = supplier.get(); | ||
|
||
processor.process(new Record<>("good", 2, 0L)); | ||
processor.close(); | ||
assertThat(sysOut.toString(StandardCharsets.UTF_8.name()), equalTo("[processor]: good, 2\n")); | ||
assertThat(sysOut.toString(StandardCharsets.UTF_8), equalTo("[processor]: good, 2\n")); |
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 should use assertEquals
instead of assertThat
final Processor<String, Integer, Void, Void> processor = new PrintedInternal<>(sysOutPrinter.withLabel("label")) | ||
.build("processor") | ||
.get(); | ||
|
||
processor.process(new Record<>("hello", 3, 0L)); | ||
processor.close(); | ||
assertThat(sysOut.toString(StandardCharsets.UTF_8.name()), equalTo("[label]: hello, 3\n")); | ||
assertThat(sysOut.toString(StandardCharsets.UTF_8), equalTo("[label]: hello, 3\n")); |
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.
ditto: We should use assertEquals
instead of assertThat
final Processor<String, Integer, Void, Void> processor = new PrintedInternal<>( | ||
sysOutPrinter.withKeyValueMapper((key, value) -> String.format("%s -> %d", key, value)) | ||
).build("processor").get(); | ||
processor.process(new Record<>("hello", 1, 0L)); | ||
processor.close(); | ||
assertThat(sysOut.toString(StandardCharsets.UTF_8.name()), equalTo("[processor]: hello -> 1\n")); | ||
assertThat(sysOut.toString(StandardCharsets.UTF_8), equalTo("[processor]: hello -> 1\n")); |
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.
ditto: We should use assertEquals
instead of assertThat
@FrankYang0529 @m1a2st Thanks very much for the code review, and I have fixed it, PTAL |
Replace
StandardCharsets.UTF_8.name()
withStandardCharsets.UTF_8
toavoid UnsupportedEncodingException and optimize the related code at the
same time.
Reviewers: Ken Huang [email protected], PoAn Yang
[email protected], Chia-Ping Tsai [email protected]