Skip to content

Commit 563b513

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

File tree

2 files changed

+198
-196
lines changed

2 files changed

+198
-196
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static byte[] getBytes(String s) {
120120
return s.getBytes("UTF-8");
121121
} catch(UnsupportedEncodingException e) {
122122
// never happens
123-
throw new RuntimeException(e);
123+
throw new RuntimeException(e.toString());
124124
}
125125
}
126126

@@ -134,7 +134,7 @@ public static String newString(byte[] b) {
134134
return new String(b, "UTF-8");
135135
} catch(UnsupportedEncodingException e) {
136136
// never happens
137-
throw new RuntimeException(e);
137+
throw new RuntimeException(e.toString());
138138
}
139139
}
140140

@@ -150,7 +150,7 @@ public static String newString(byte[] b, int offset, int length) {
150150
return new String(b, offset, length, "UTF-8");
151151
} catch(UnsupportedEncodingException e) {
152152
// never happens
153-
throw new RuntimeException(e);
153+
throw new RuntimeException(e.toString());
154154
}
155155
}
156156

@@ -164,7 +164,7 @@ public static InputStreamReader getReader(InputStream in) {
164164
return new InputStreamReader(in, "UTF-8");
165165
} catch(UnsupportedEncodingException e) {
166166
// never happens
167-
throw new RuntimeException(e);
167+
throw new RuntimeException(e.toString());
168168
}
169169
}
170170

@@ -178,7 +178,7 @@ public static OutputStreamWriter getWriter(OutputStream out) {
178178
return new OutputStreamWriter(out, "UTF-8");
179179
} catch(UnsupportedEncodingException e) {
180180
// never happens
181-
throw new RuntimeException(e);
181+
throw new RuntimeException(e.toString());
182182
}
183183
}
184184

0 commit comments

Comments
 (0)