tracker issue : CF-4204709

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

ImageDrawText throws ClassCastException when parsing "Size" values

| View in Tracker

Status/Resolution/Reason: Open//

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

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

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))



The same code DOES work in 2018,0,04,314546 CFFiddle: <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