tracker issue : CF-4198311

select a category, or use search below
(searches all categories and all time range)
Title:

Returning an object in a json response that has a property type mismatch throws a java cast error.

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/BugVerified

Reporter/Name(from Bugbase): Daniel Roberts / Daniel Roberts ()

Created: 02/03/2017

Components: Web Services

Versions: 10.0

Failure Type: Memory Leak

Found In Build/Fixed In Build: ColdFusion 10 Update 22 /

Priority/Frequency: Normal / All users will encounter

Locale/System: / Win 2008 Server R2 64 bit

Vote Count: 0

Returning an object in a webservices json response that has a property type mismatch throws a java cast error instead of CF automatically converting the variable as expected.

http://imgur.com/a/EN9EH

Steps to Reproduce:
1. create a cfc and function to call as http webservice
2. create an object to return as response with property of type "string"
3. in webservice cfc function create the response object and then set the property equal to val(1) and return
4. hit the webservice url with returntype=json

Actual Result:
Error java.lang.Double cannot be cast to java.lang.String

Expected Result:
automatic type conversion

Any Workarounds:
Wrapping the variable being set to the response property in toString(). This is especially a problem when using query recordsets as every number or date column will fail during the json response if there is a type mismatch.

Attachments:

  1. February 03, 2017 00:00:00: response.cfc

Comments: