-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Issue Jenkins-36718 - Fix DM_DEFAULT_ENCODING scanned by spotbugs #9784
base: master
Are you sure you want to change the base?
Changes from 8 commits
ccfcdcf
5d4df0f
269c15d
ee36579
58a5fbc
2233755
f5796ee
0ce78b7
9f23a25
2391b64
64c0d25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,7 +194,7 @@ | |
* encoding is ASCII compatible. | ||
*/ | ||
public void encodeTo(Writer out) throws IOException { | ||
out.write(encodeToBytes().toString()); | ||
out.write(new String(encodeToBytes().toByteArray(), StandardCharsets.UTF_8)); | ||
} | ||
|
||
private ByteArrayOutputStream encodeToBytes() throws IOException { | ||
|
@@ -224,7 +224,8 @@ | |
* Works like {@link #encodeTo(Writer)} but obtain the result as a string. | ||
*/ | ||
public String encode() throws IOException { | ||
return encodeToBytes().toString(); | ||
return new String(encodeToBytes().toByteArray(), StandardCharsets.UTF_8); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're correct, sir. Changes were made according to your suggestion! Thank you! |
||
// return encodeToBytes().toString(); | ||
} | ||
|
||
/** | ||
|
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.
@programbeginnerTW Could you please check this warning message, please?
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.
@A1exKH Thanks for the reply,
Seems the coverage shrunk in this modification, the previous scan was 2, and now 1 has missed.
Should I simply add a new test for it? Or should I revise and review if there's anything I can do?