tracker issue : CF-4126411

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

replace() causes java.lang.Integer cannot be cast to java.lang.String

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Harry Klein / Harry Klein (Harry Klein)

Created: 03/09/2016

Components: Language

Versions: 2016

Failure Type:

Found In Build/Fixed In Build: RC_v12 /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win All

Vote Count: 1

Listed in the version 2016.0.01.298513 Issues Fixed doc
Verification notes: verified_fixed on July 30, 2017 using build 2016.0.01.298513
Problem Description:
<cfset stItem[sCol] = replace(stItem[sCol], fieldel, arguments.stMixin.stResult[item['page_id']][fieldel])>

replace arg1 value = 1000
replace arg2 value = page_id
replace arg3 value = 1047

Steps to Reproduce:
-

Actual Result:
{""Cause"":null,""Message"":""java.lang.Integer cannot be cast to java.lang.String"",""LocalizedMessage"":""java.lang.Integer cannot be cast to java.lang.String"",""StackTrace"":[{""FileName"":""StringFunc.java"",""NativeMethod"":false,""ClassName"":""coldfusion.runtime.StringFunc"",""LineNumber"":357,""MethodName"":""Replace""}

Expected Result:
Replace the values, even if they are integers!

Any Workarounds:
Add toString()
<cfset stItem[sCol] = replace(stItem[sCol], fieldel, arguments.stMixin.stResult[item['page_id']][fieldel].toString())>

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4126411

External Customer Info:
External Company: CONTENS
External Customer Name: Harry Klein
External Customer Email: KLEIN@CONTENS.DE
External Test Config:

Attachments:

Comments:

Adding BUG AUDIT TRAIL ********action: updated fieldName: Fix By Milestone newValue: Post Release oldValue: Alpha oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-12 06:41:35.0 action: updated fieldName: Fix By Product Milestone newValue: HF1 oldValue: Alpha oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-12 06:41:35.0 action: updated fieldName: Changelist newValue: 298018 oldValue: Blank oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 06:10:38.0 action: updated fieldName: Reason newValue: Fixed oldValue: BugVerified oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 06:10:38.0 action: updated fieldName: Fixed By newValue: himar oldValue: Blank oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 06:10:38.0 action: updated fieldName: Date Fixed newValue: 2016-02-11 22:10:38.0 oldValue: Blank oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 06:10:38.0 action: updated fieldName: Status newValue: ToTest oldValue: ToFix oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 06:10:38.0 action: updated fieldName: Owner newValue: suchsing oldValue: himar oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 06:10:38.0 action: updated fieldName: Priority newValue: 3 oldValue: 0 oprid: hkallae recordName: RQ_DEFECT timpestamp: 2016-02-12 06:03:07.0 action: updated fieldName: Dev Assigned newValue: himar oldValue: awdhesh oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 05:44:35.0 action: updated fieldName: Owner newValue: himar oldValue: awdhesh oprid: himar recordName: RQ_DEFECT timpestamp: 2016-02-12 05:44:35.0 action: updated fieldName: Owner newValue: awdhesh oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2016-02-11 11:05:13.0 action: updated fieldName: Reason newValue: BugVerified oldValue: PRHaveInfo oprid: suchsing recordName: RQ_DEFECT timpestamp: 2016-02-11 11:05:13.0 action: updated fieldName: Status newValue: ToFix oldValue: ToTrack oprid: suchsing recordName: RQ_DEFECT timpestamp: 2016-02-11 11:05:13.0 action: updated fieldName: Fix By Milestone newValue: Alpha oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2016-02-11 11:05:13.0 action: updated fieldName: Fix By Product Milestone newValue: Alpha oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2016-02-11 11:05:13.0 action: updated fieldName: State newValue: Open oldValue: Open oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-10 08:33:52.0 action: updated fieldName: Status newValue: ToTrack oldValue: ToTrack oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-10 08:33:52.0 action: updated fieldName: Reason newValue: PRHaveInfo oldValue: PRNeedInfo oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-10 08:33:52.0 action: updated fieldName: Reason newValue: PRNeedInfo oldValue: PRHaveInfo oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-08 16:31:40.0 action: updated fieldName: State newValue: Open oldValue: Open oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-08 16:16:27.0 action: updated fieldName: Status newValue: ToTrack oldValue: ToTrack oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-08 16:16:27.0 action: updated fieldName: Reason newValue: PRHaveInfo oldValue: PRNeedInfo oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-08 16:16:27.0 action: updated fieldName: Reason newValue: PRNeedInfo oldValue: PRHaveInfo oprid: hkallae recordName: RQ_DEFECT timpestamp: 2016-02-08 14:38:16.0 action: updated fieldName: State newValue: Open oldValue: Open oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-08 10:10:00.0 action: updated fieldName: Reason newValue: PRHaveInfo oldValue: PRNeedInfo oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-08 10:10:00.0 action: updated fieldName: Status newValue: ToTrack oldValue: ToTrack oprid: prerelease recordName: RQ_DEFECT timpestamp: 2016-02-08 10:10:00.0 action: updated fieldName: Reason newValue: PRNeedInfo oldValue: Blank oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-06 04:40:04.0 action: updated fieldName: Status newValue: ToTrack oldValue: Unverified oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-06 04:40:04.0 action: updated fieldName: QE Assigned newValue: suchsing oldValue: inoel oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2016-02-05 18:06:51.0 action: updated fieldName: Owner newValue: suchsing oldValue: inoel oprid: nimsharm recordName: RQ_DEFECT timpestamp: 2016-02-05 18:06:51.0
Comment by CFwatson U.
4218 | March 09, 2016 01:58:44 AM GMT
Added By: PreRelease User User Name:Harry Klein Note Added: This issue can be closed Date Added :2016-02-26 11:25:16.0 Added By: PreRelease User User Name:Harry Klein Note Added: Seems to be fixed, my tests very positive Date Added :2016-02-16 09:46:51.0 Added By:suchsing Note Added: Thanks Harry, We are looking into this. Date Added :2016-02-11 09:21:32.0 Added By: PreRelease User User Name:Harry Klein Note Added: I managed to create a reproducable testfile, see attached file in issue CF-4114981 Date Added :2016-02-11 09:17:56.0 Added By: PreRelease User User Name:Harry Klein Note Added: Teamviewer? Date Added :2016-02-10 08:33:52.0 Added By: PreRelease User User Name:Harry Klein Note Added: I am sorry, but it would take hours to isolate this issue. I could show you the problem via Teamviewer? Date Added :2016-02-08 16:16:27.0 Added By:hkallae Note Added: Hey Harry, Can you please send a simple snippet to repro this issue? Date Added :2016-02-08 14:38:18.0 Added By:vmannebo Note Added: Thanks Harry. We are looking into this. Date Added :2016-02-08 10:45:30.0 Added By: PreRelease User User Name:Harry Klein Note Added: <cffunction name="formatForList" access="private" returntype="array" output="false" hint="formats the results as an array"> <cfargument name="args" type="struct" required="true"> <cfargument name="stMixin" type="struct" required="false" default="#structnew()#"> <!--- this function is manually created to prepare the search results for the global search ---> <cfset var local = structNew()> <cfset var stItem = structNew()> <cfset var sDefaultColumns = arguments.args.resultColumns> <cfset var searchResults = arguments.args.stSearchResults.searchresults> <cfset var sTblPrefixes = "co_objects.,co_languages.,co_objectlangdata."> <cfset var item = ""> <cfset var sCol = ""> <cfset var results = ""> <cfset var sPrefix = ""> <cfset var qSorted = ""> <cfset var iRow = 0> <cfset var sColumns = "page_id|pagenavititle|site_ID|lang_IDtxt|lang_id"> <cfset var sDisplayColumns = "page_id|pagenavititle|site_ID|lang_IDtxt|lang_id"> <cfset var aReturn = arrayNew(1)> <cfset var stCol = structNew()> <cfset var field = ""> <cfset var fieldel = ""> <cfset results = arrayNew(1)> <cfloop array="#searchResults#" index="item"> <cfset stItem = structNew()> <cfloop list="#sDisplayColumns#" index="sCol" delimiters="|"> <cfset stItem[sCol] = sCol> <cfloop list="#sCol#" index="fieldel" delimiters=","> <cfif structKeyExists(item,fieldel)> <cfset stItem[sCol] = replace(stItem[sCol],fieldel,item[fieldel])> </cfif> <cfif structKeyExists(arguments.stMixin.stResult,item['page_id']) AND structKeyExists(arguments.stMixin.stResult[item['page_id']],fieldel)> <!--- toString is only needed in ACF2016 rc, remove this method call after issue is fixed ---> <cfset stItem[sCol] = replace(stItem[sCol],fieldel,arguments.stMixin.stResult[item['page_id']][fieldel].toString())> </cfif> </cfloop> </cfloop> <cfset arrayAppend(results,stitem)> </cfloop> <cfreturn results> </cffunction> Date Added :2016-02-08 10:09:59.0 Added By:vmannebo Note Added: Can you quickly send across the code snippet? Date Added :2016-02-06 04:40:08.0 Added By: PreRelease User User Name:Harry Klein Note Added: Entered Bug. Date Added :2016-02-05 17:57:56.0
Comment by CFwatson U.
4219 | March 09, 2016 01:58:46 AM GMT
The replace() function is used a lot in my company and this bug broke my programs.
Vote by External U.
4221 | April 01, 2016 11:15:50 AM GMT
Verified, on April 12, 2016, that this is fixed in CF2016 Update 1 (build 2016.0.01.298513). Thanks!, -Aaron
Comment by Aaron N.
4220 | July 30, 2017 06:20:07 PM GMT