Copy link to clipboard
Copied
applied update 17 to some of our dev servers and was told that certain code no longer works -
specifically when invoking the split command -
the below code is something being actively worked on - my concern is that there might be other things it could affect - is this unusual?
<cfif len(trim(manager)) gt 0>
<cfset mgr = manager.split(",")[1]/>
<cfset mgr = mgr.substring(3,len(mgr))/>
<cfset mgr_fname = mgr.split(' ')[1]/>
<cfset mgr_lname = mgr.split(' ')[2]/>
<cfelse>
<cfset mgr = ''/>
<cfset mgr_fname = ''/>
<cfset mgr_lname = ''/>
</cfif>
error from log:
Error","ajp-nio-127.0.0.1-8020-exec-9","10/24/24","11:00:00","HumanscaleHostSite","The split method was not found.Either there are no methods with the specified method name and argument types or the split method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity. The specific sequence of files included or processed is: E:\internal\betahost.h\schedtasks\ad.cfm, line: 17"
Try wrapping the value with toString() first, eg: toString(manager).split(",")[1]
--
Pete Freitag
I now suspect the error arises because ColdFusion is confusing the manager in variables scope with the manager in query scope. So, separate the concerns. For example, by introducing a new variable, currentManager, in variables scope.
To be clear, here's the suggestion in full
<cfloop query="Q_ADResults">
<cftry>
<cfset currentManager = trim(toString(Q_ADResults.manager[currentrow]))>
<cfif len(currentManager) gt 0>
<cfset mgr = currentManager.split(",")[1]/>
...
Copy link to clipboard
Copied
Hi Charlie,
Here is a dump of the variable when it fails,
CurrentRow: 2
CN=Erica (Gaynier) Feldman,OU=Sales,OU=Remote - United States,OU=United States,OU=North America,OU=Domain Users,OU=Offices,DC=humanscale,DC=com
vs
after adding tostring(), below is the dump again when it works,
CurrentRow: 2
CN=Erica (Gaynier) Feldman,OU=Sales,OU=Remote - United States,OU=United States,OU=North America,OU=Domain Users,OU=Offices,DC=humanscale,DC=com
It looks all the same.
Copy link to clipboard
Copied
But we don't need to see a comparison of the dump when things fail vs when you add tostring to get it to work. We need to see the dump of the manager variable when the data causes the split to fail vs when the data lets it work.
And please don't use the text format but the traditional html one, with the extra info that may convey regarding the contents of that object. Feel free to take a screenshot of the dumps.