tracker issue : CF-4204709

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

ImageDrawText throws ClassCastException when parsing "Size" values

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): N T. / ()

Created: 07/04/2019

Components: Functions

Versions: 2016

Failure Type:

Found In Build/Fixed In Build: 2016,0,11,314546 /

Priority/Frequency: Normal /

Locale/System: / Windows 7 64-bit

Vote Count: 0

Problem Description:
ImageDrawText throws an error when attempting to parse certain "Size" values into an integer.

See this thread for further details
https://stackoverflow.com/a/56894469/8895292

Steps to Reproduce:
<cfscript>
    // 2016,0,11,314546 
    writeDump( server.coldfusion );
    newImg = imageNew("", 100, 100);
    setup['size'] = javacast("int", 123);
    imageDrawText(newImg, "some text", 10, 10, setup);
</cfscript>

Actual Result:
 java.lang.Integer cannot be cast to java.lang.String
Type: java.lang.ClassCastException 

Expected Result:
Function call should succeed without error
Any Workarounds:
Manually convert the "size" value to an integer, and then cast it as a string:

setup['size'] = toString(floor(theInputValue))

Attachments:

Comments:

The same code DOES work in 2018,0,04,314546 CFFiddle: https://cffiddle.org/app/file?filepath=716abea1-1adb-49fd-ba5d-61d74bde5c54/c4f7d4f0-e512-4e1f-af93-18f3414f5bcb/1427aaef-c60a-47fc-ac5f-a66366c9ded9.cfm <cfscript> newImg = imageNew("", 100, 100); setup['size'] =javacast("double", 123); imageDrawText(newImg, "some text", 10, 10, setup); writeDump("Success"); </cfscript>
Comment by N T.
30989 | July 04, 2019 10:12:47 PM GMT