Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)
Created: 08/11/2015
Components: Language, Serialization
Versions: 11.0
Failure Type: Enhancement Request
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / Some users will encounter
Locale/System: ALL / Platforms All
Vote Count: 0
preserveCaseForQueryColumn breaks serializeJSON()
Steps to reproduce:
1) Run below code
2) See error: "Error casting an object of type java.lang.Boolean cannot be cast to java.lang.String to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.
java.lang.Boolean cannot be cast to java.lang.String"
3) Change !structKeyExists(URL, "_cf_ajaxproxytoken") to toString(!structKeyExists(URL, "_cf_ajaxproxytoken"))
4) Run updated code and see serialization is successful
Application.cfc
---------------
component {
THIS.name = "ticket_preserveCaseForQueryColumn_breaksSerializeJSON";
THIS.serialization.preserveCaseForQueryColumn = !structKeyExists(URL, "_cf_ajaxproxytoken");//workaround for #4034396
void function onRequest() {
var q = queryNew("fooCol,barCol", "varchar,varchar", [['one','uno'],['two','dos']]);
var s = serializeJSON(q);//see error: "java.lang.Boolean cannot be cast to java.lang.String"
writeOutput(s);
}
}
index.cfm
---------
[empty file]
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4034418
External Customer Info:
External Company:
External Customer Name: Aaron
External Customer Email:
Attachments:
Comments: