Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): A. Bakia / Alfred Bakia (A. Bakia)
Created: 12/30/2008
Components: General Server
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 / 226087
Priority/Frequency: Major / Unknown
Locale/System: English / Win All
Vote Count: 0
Problem:
The java.lang.String function toCharArray() returns an array of char primitives in Java. However, in Coldfusion Centaur, it returns an array of java.lang.Character objects instead.
Method:
1) If you run the following code in Java it will display the characters in the text myString. That is, the function toCharArray() returns an array of char primitives. That is the expected behaviour.
String myString = new String("This is my sample string.");
char[] myCharArray = myString.toCharArray();
for (int k = 0; k <= myCharArray.length-1; k++){
System.out.print(myCharArray[k]);
}
2) However, if you run the Coldfusion version of the code, which follows, the function toCharArray() returns an array of java.lang.Character objects instead.
<cfset sampleText = "This is my sample string.">
<cfset myString = createobject("java","java.lang.String").init(javacast("string",sampleText))>
<cfset myCharArray = myString.toCharArray()>
<cfdump var="#myCharArray#">
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3037149
External Customer Info:
External Company:
External Customer Name: Alfred Bakia
External Customer Email: 4E2913DC4455DE13992016B6
External Test Config: 12/30/2008
Attachments:
Comments: