Skip to content

Commit d7bb056

Browse files
Fix SpotBugs DM_DEFAULT_ENCODING by using Util helper methods for explicit UTF-8 encoding
1 parent 4b716ce commit d7bb056

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CodenameOne/src/com/codename1/io/Log.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public static String getLogContent() {
336336
char[] buffer = new char[1024];
337337
int size = r.read(buffer);
338338
while (size > -1) {
339-
text += Util.newString(buffer, 0, size);
339+
text += new String(buffer, 0, size);
340340
size = r.read(buffer);
341341
}
342342
r.close();

CodenameOne/src/com/codename1/io/Util.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static String newString(byte[] b, int offset, int length) {
159159
* @param in the input stream
160160
* @return the reader
161161
*/
162-
public static Reader getReader(InputStream in) {
162+
public static InputStreamReader getReader(InputStream in) {
163163
try {
164164
return new InputStreamReader(in, "UTF-8");
165165
} catch(UnsupportedEncodingException e) {
@@ -173,7 +173,7 @@ public static Reader getReader(InputStream in) {
173173
* @param out the output stream
174174
* @return the writer
175175
*/
176-
public static Writer getWriter(OutputStream out) {
176+
public static OutputStreamWriter getWriter(OutputStream out) {
177177
try {
178178
return new OutputStreamWriter(out, "UTF-8");
179179
} catch(UnsupportedEncodingException e) {

0 commit comments

Comments
 (0)