MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / toCharArray

Method toCharArray

CodenameOne/src/com/codename1/io/Util.java:1293–1309  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

1291 ///
1292 /// the contents of the string as a char array guaranteed to be a copy of the current array
1293 public static char[] toCharArray(String s) {
1294 // toCharArray should return a new array always, however some devices might
1295 // suffer a bug that allows mutating a String (serious security hole in the JVM)
1296 // hence this method simulates the proper behavior
1297 if (!charArrayBugTested) {
1298 charArrayBugTested = true;
1299 if (s.toCharArray() == s.toCharArray()) { //NOPMD CompareObjectsWithEquals
1300 charArrayBug = true;
1301 }
1302 }
1303 if (charArrayBug) {
1304 char[] c = new char[s.length()];
1305 System.arraycopy(s.toCharArray(), 0, c, 0, c.length);
1306 return c;
1307 }
1308 return s.toCharArray();
1309 }
1310
1311 private static String encode(String str, String spaceChar) {
1312 if (str == null) {

Callers 15

encodeMethod · 0.95
parseTileJsonTemplateMethod · 0.45
fromJsonMethod · 0.45
Base32Class · 0.45
parseJSONMethod · 0.45
parseLongMethod · 0.45
encodeUrlMethod · 0.45
sanitizeStringMethod · 0.45
readResponseMethod · 0.45
getCharLocationMethod · 0.45

Calls 2

arraycopyMethod · 0.95
lengthMethod · 0.65

Tested by

no test coverage detected