• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

update 17 and split

New Here ,
Oct 24, 2024 Oct 24, 2024

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"

Views

761

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Enthusiast , Oct 30, 2024 Oct 30, 2024

Try wrapping the value with toString() first, eg: toString(manager).split(",")[1]

 

--

Pete Freitag

Foundeo Inc.

Votes

Translate

Translate
Community Expert , Oct 30, 2024 Oct 30, 2024

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]/>
            
...

Votes

Translate

Translate
Explorer ,
Oct 25, 2024 Oct 25, 2024

Copy link to clipboard

Copied

None of those are CFML member functions, they are methods of `java.lang.String`. A pure CFML version of the above would be to use `listToArray()` and `mid`. 

 

Having said that I wouldn't expect the behaviour to change. Judging my the error you mention of `The split method was not found.` I think the issue is that `manager` is not being set to a string at all.

 

Here is your code running on ACF2021 update 17 with no errors when manager is a string.

 

https://cffiddle.org/app/file?filepath=9f029a87-df43-4679-8ad1-e68e1aef64e4/af5419cf-9755-4f3a-998d-...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Like @aliaspooryorik , I too did a test on CFFiddle using Update 17 of ColdFusion 2021. There was no error.

<cfset manager ="John James Smith,Mary Jane Robinson">

<cfif len(trim(manager)) gt 0>
	<cfset mgr = manager.split(",")[2]/>
	<cfset mgr = mgr.substring(5,len(mgr))/>
	<cfset mgr_middle_name = mgr.split(' ')[1]/>
	<cfset mgr_last_name = mgr.split(' ')[2]/>
<cfelse>
	<cfset mgr = ''/>
	<cfset mgr_fname = ''/>
	<cfset mgr_lname = ''/>
</cfif>
<cfoutput>
	mgr_middle_name: #mgr_middle_name# <br>
	mgr_last_name: #mgr_last_name# 
</cfoutput>

https://cffiddle.org/app/file?filepath=5149d2c1-49d1-4aca-879c-4e6ef33ff4c3/e3ecff66-71ce-4e00-bd2e-... 

BKBK_0-1730022530469.png

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2024 Oct 28, 2024

Copy link to clipboard

Copied

Hi Support,

 

We do understand you run the code using hardcoded value for the manager string returning no error, and we ran the same, also no errors. However, the manager field / string values are returned from AD (Active Directory) using cfldap. Let me show you more in the code as below (removed the server name and creds for demonstration purpose).

 

The manager attribute from AD contains the value like this

 

CN=Maria Guadalupe López,OU=Human Resources,OU=Nogales,OU=Mexico,OU=North America,OU=Domain Users,OU=Offices,DC=humanscale,DC=com

 

In some cases, people’s name would have special characters in Spanish or French name, not sure if that would affect anything for the split function. We have changed to use mid function instead. But we were wondering the same code using the java split function worked with no errors before the update 17. Please let us know if you have any ideas. Thanks for your time.

 

<cfldap action="query"

   server=""

   name="Q_ADResults"

   start=""

   username=""

   password=""

   attributes ="createTimestamp,whenChanged,department, givenname,sn,cn,displayname,samaccountname,userprincipalname,lockoutTime,lockoutDuration,IsAccountLocked,title,mail,physicalDeliveryOfficeName,streetaddress,l,st,postalcode,co,c,hometelephone,telephoneNumber,mobile,fax,manager,ExtensionAttribute1"

   scope="subtree">

              

<cfloop query=#Q_ADResults#>

<cftry>

                              <cfif len(trim(Q_ADResults.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>

    <cfcatch>

               <cfoutput>#Q_ADResults.manager#</cfoutput><br>

               </cfcatch>

</cftry>

</cfloop>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2024 Oct 28, 2024

Copy link to clipboard

Copied

Taking the hint from you, I ran the following code on CF2021 Update 17 on Cffiddle:

 

<cfset manager ="CN=Maria Guadalupe López,OU=Human Resources,OU=Nogales,OU=Mexico,OU=North America,OU=Domain Users,OU=Offices,DC=humanscale,DC=com">

<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_mname = mgr.split(' ')[2]/>
	<cfset mgr_lname = mgr.split(' ')[3]/>
<cfelse>
	<cfset mgr = ''/>
	<cfset mgr_fname = ''/>
	<cfset mgr_mname = ''/>
	<cfset mgr_lname = ''/>
</cfif>
<cfoutput>
	mgr_fname: #mgr_fname# <br>
	mgr_mname: #mgr_mname# <br>
	mgr_lname: #mgr_lname# <br>
</cfoutput>

 

https://cffiddle.org/app/file?filepath=9cf84e08-8565-43b6-b710-d8a0472bb9ac/73ad24d8-be36-4aa6-8586-... 

 

As you can see, it works as expected.

BKBK_0-1730141542688.png

 

If you're still having an issue with this, then you will probably have to look elsewhere. For example, shouldn't the line

 

  <cfset mgr = manager.split(",")[1]/>

 

be

 

  <cfset mgr = Q_ADResults.manager.split(",")[1]/>

 

instead?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2024 Oct 28, 2024

Copy link to clipboard

Copied

Hi Support,

 

We did try using the hardcoded for the below, and there is no error.

 

<cfset manager ="CN=Maria Guadalupe López,OU=Human Resources,OU=Nogales,OU=Mexico,OU=North America,OU=Domain Users,OU=Offices,DC=humanscale,DC=com">

But wondering the string returned from AD might have been different format or acting up diffrently? therefore the error shows split method not found, and was suggested to use javacast, but we did not have to before the update 17, which is the question in doubt why.

 

 We tried this instead as you suggested, still same error.

 

<cfset mgr = Q_ADResults.manager.split(",")[1]/>

 Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2024 Oct 29, 2024

Copy link to clipboard

Copied

Thanks for your explanation. It made me look further. As a result, I can see a possible cause of the problem.

 

In the way we defined the variable Q_ADResults.manager, we treated Q_ADResults as a struct, hence overlooking the fact that it is a query.

 

Solution: in the loop, replace

Q_ADResults.manager

with

Q_ADResults.manager[currentrow]

 

That is, use

<cfloop query="Q_ADResults"> <!--- Using # not necessary--->
	<cftry>
	<cfset manager = trim(Q_ADResults.manager[currentrow])>
	<cfif len(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>
	<cfcatch>
		<cfoutput>#Q_ADResults.manager[currentrow]#</cfoutput><br>
	</cfcatch>
	</cftry>
</cfloop>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 29, 2024 Oct 29, 2024

Copy link to clipboard

Copied

Hi Support,

 

Thanks for the suggestion. Unfortunately, we tried it, and still got the split method was not found error.

 

<cfloop query=#Q_ADResults#>
 
 
<cftry>
<cfset manager = trim(Q_ADResults.manager[currentrow])>
<cfif len(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>
    <cfcatch>
<cfoutput>#Q_ADResults.manager[currentrow]#</cfoutput><br>
 
</cfcatch>
</cftry>
 
</cfloop>
 
patrick_8394_0-1730249075344.png

Thanks for your time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 30, 2024 Oct 30, 2024

Copy link to clipboard

Copied

Try wrapping the value with toString() first, eg: toString(manager).split(",")[1]

 

--

Pete Freitag

Foundeo Inc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2024 Oct 30, 2024

Copy link to clipboard

Copied

quote

Thanks for the suggestion. Unfortunately, we tried it, and still got the split method was not found error.

 

<cfloop query=#Q_ADResults#>
 
By @patrick_8394

 

As I said, change that line to

 

<cfloop query="Q_ADResults">

 

and apply Pete's suggestion, too.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2024 Oct 30, 2024

Copy link to clipboard

Copied

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]/>
                 <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>
  
   <cfoutput>             
       mgr_fname: #mgr_fname#  <br>
       mgr_lname: #mgr_lname#  <br>
   </cfoutput>
 
<cfcatch>
   CurrentManager: <cfoutput>#currentManager#</cfoutput><br>  
</cfcatch>
</cftry>
</cfloop>

 

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

Hi @Pete220652393l9r ,

Did the suggestions help solve the problem?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

I realize this is a few days after your original question, but assuming the problem remains (and beyond the ideas shared so far by Yorik, Patrick, bkbk and Pete), I have a different question, especially since you say the problem happens only on SOME of your AD query results. 

 

I think a simple change will help better diagnose what's amiss. First, it's not clear whether your error is happening on line 2, 4, or 5 of your code. There error refers to line 17. Assuming that's line 2 above, what do you see if you change that line:

 

<cfset mgr = manager.split(",")[1]/>

 

to:

 

<cftry>
   <cfset mgr = manager.split(",")[1]/>
   <cfcatch>
      <cfdump var="#manager#" >
      <cfabort>
   </cfcatch>
</cftry>

 

 

The point here is to see just what is in that manager scope. Or if you want to, you could put all the code in the cftry and dump both the manager and mgr variables, since again we can't know from the error which is the one that has your issue.

 

Finally, you've not said what cf update you were on BEFORE applying cf2021 update 17. Was it before update 13? If so, there may be a connection to its change of default behavior regarding implicit scope searching. See the technote for that update for more on that change, as well as options for reverting the behavior change at the app or jvm level.  If somehow the dump doesn't help, and you were on update 12 or earlier, let us know if changing that default behavior might help. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

Charlie, my last post contains your suggestion. It is clear from my last post that the issue is caused by the variable manager calling the split method.

 

In fact, you can reproduce it yourself, using:

 

<cfset Q_ADResults = queryNew("manager","varchar", {manager="CN=Maria Guadalupe López,OU=Human Resources,OU=Nogales,OU=Mexico,OU=North America,OU=Domain Users,OU=Offices,DC=humanscale,DC=com"})>

<cfloop query="Q_ADResults">
	<cftry>
		<cfset mgr = manager.split(",")[1]/>
	<cfcatch>
		manager variable is of type:<cfoutput> #manager.getClass().getName()#</cfoutput> <br><br>
	   <cfdump var="#cfcatch#" label="cfcatch dump">
	   
	</cfcatch>
	</cftry>
</cfloop>

 

The result is

BKBK_0-1730651247734.png

The cause of the issue is that the method split() is being called by manager, which is not of String type. It is of type coldfusion.sql.QueryColumn.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

Bkbk, while your dump is looking at the variable in your sample code, my focus was focused on Pete's original code...to help him given that his reply to you earlier said his AD query was returning different info.

 

Are you trying to assert in your code that you've found the exact cause and solution? Or was yours just some more code to help Pete try to figure things out? That's how I read it, so mine was indeed added as SEPERATE from what you wrote--which is in fact why I created it as a new thread (though I acknowledged what you and Pete F had written). As you often like to point out, we're all here trying to help. I didn't feel my suggestion was stepping on or dismissing yours.

 

And either way, my question to him about his update level still stands. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

quote

Are you trying to assert in your code that you've found the exact cause and solution?


By @Charlie Arehart

 

Yes. My last post shows the cause: calling split() on an object of type coldfusion.sql.QueryColumn.

For a solution, see the above code containing the line

 

 <cfset currentManager = trim(toString(Q_ADResults.manager[currentrow]))>

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

Ok, let's see if Pete agrees.

 

(He may see/reply only to the thread where you first offered this. If it doesn't help in his special case, I'll hope he notices this other thread.) 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 05, 2024 Nov 05, 2024

Copy link to clipboard

Copied

Hi all (Community Experts):

 

Thanks much for sharing your thought and your time. We have tried tostring() below, and it worked, no more split method not found error!!

 

<cfset mgr = tostring(manager).split(",")[1]/>

 

<cfset currentManager = trim(toString(Q_ADResults.manager[currentrow]))>

 

Before applying update 17, it was on update 15. Somehow, the tostring() was not needed at that time and it worked fine without any errors until the update 17.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

Thanks for the update, @Pete220652393l9r . It makes sense that casting coldfusion.sql.QueryColumn to String works

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

While everyone seems happy to declare totring as the winning answer (with the two responses about that being marked as the "answers"), I'd contend this issue still begs unanswered questions.

 

First Patrick, I'd asked you just above to do a dump of the variable when it fails. It would be very interesting to know what that shows vs when it works. Then we may be able to get to the root cause problem.

 

One other thing: this could even be one of those sort of problems solved by clearing the felix-cache (as discussed in the update technote) vs making code changes. That affects the underlying Java objects and methods in a way that could well be where your issue arise.

 

I appreciate you may be happy to have found "any solution", but l would lament if future readers saw those two currently marked answers about tostring if that proved ultimately to be an unnecessary workaround. Sadly most won't read the rest to hear if this might be the alternative root cause solution. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

Charlie, the root cause of the problem is clear. As I mentioned earlier, "the issue is caused by the variable manager calling the split method.". The variable is of type coldfusion.sql.QueryColomn, for which there is no split method.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

My focus is on how some of his cfldap query results would work but not others, as well as the asserted change being due to the recent cf update.

 

I don't see how your conclusion closes those considerations.


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

quote

I don't see how your conclusion closes those considerations.


By @Charlie Arehart

 

The error is "The split method was not found". I just wanted to clear any questions about the root cause of the error.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

You have not succeeded in that desire, otherwise I wouldn't be asking. Anyway, my question was for Patrick. If he opts not to reply, then I leave what I said for the sake of others.


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2024 Nov 06, 2024

Copy link to clipboard

Copied

I'll leave it there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation