tracker issue : CF-3231457

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

Method chaining support inconsitent with CFCs and use of java objects

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

Reporter/Name(from Bugbase): Erik Madsen / Erik Madsen (ErikMadsen)

Created: 07/06/2012

Components: Language, CF Component

Versions: 9.0.1

Failure Type: Non Functioning

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Win 2008 Server x64

Vote Count: 6

Problem Description: A Java class with methods such as "is()" and "contains()" that is instantiated by CF via createObject does not make such methods available.

Steps to Reproduce:

Example 1 (Java Object)

{code:java}
<cfscript>
gate = createObject( "java", "com.braintreegateway.BraintreeGateway" ).init(env,merchant.getMerchantAccountId(), merchant.getMerchantAccountPublicSecret(),merchant.getMerchantAccountPrivateSecret());
req = createObject( "java","com.braintreegateway.CustomerSearchRequest").id().is("#user.getUserId()#");
customer = gate.customer().search(req);
</cfscript>
{code}

Error Thrown: Invalid CFML construct ... ColdFusion was looking at the following text: is

Example 2 (CFC)

<!--- Junk.cfc --->

{code:java}
<cfcomponent>
    <cffunction name="is">
        <cfreturn true>
    </cffunction>
    <cffunction name="contains">
        <cfreturn true>
    </cffunction>
</cfcomponent>
{code}


<!--- test.cfm --->

{code:java}
<cfset o = new Junk()>

<cfoutput>
    #o.is()#<br />
    #o.contains()#<br />
</cfoutput>
{code}

This - predictably - outputs:

true
true
However we have problems if we introduce a init() method to Junk.cfc, thus:


{code:java}
<cffunction name="init">
    <cfreturn this>
</cffunction>
{code}

And then adjust test.cfm accordingly:


{code:java}
#o.init().is()#<br />
#o.init().contains()#<br />
{code}


Actual Result:  Compiler error... Invalid CFML construct found on line x at column xx.

ColdFusion was looking at the following text:

is

[...]

coldfusion.compiler.ParseException: Invalid CFML construct found on line 4 at column 19.

at coldfusion.compiler.cfml40.generateParseException(cfml40.java:12135)
[etc]

There is no valid reason why o.init().is() should not be OK if o.is() is fine.

Expected Result:

Any Workarounds: None known

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

Watson Bug ID:	3231457

External Customer Info:
External Company:  
External Customer Name: ErikMadsen
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Yeah, this should "just work". -- Adam
Vote by External U.
18778 | July 06, 2012 09:15:39 AM GMT
required for braintree integration
Vote by External U.
18779 | February 24, 2013 07:22:40 AM GMT
This is a much needed fix.
Vote by External U.
18780 | November 05, 2013 03:57:22 PM GMT
Bug Verified (Comment added from ex-user id:vnigam)
Comment by Adobe D.
18774 | December 17, 2013 08:04:25 AM GMT
This is an edge case where parser breaks while parsing a method chain where one of the function name is one of the ColdFusion special keys like is, contains, EQ etc. Making required changes in the parser at this moment would be bit risky.
Comment by Awdhesh K.
18775 | December 18, 2013 02:48:45 AM GMT
"At this moment"? You've had the issue in front of you for a year and a half: how come you're only getting around to looking at it *now*, when you're pushed for time? -- Adam
Comment by External U.
18776 | January 02, 2014 05:35:08 AM GMT
bugs like this should be fixed promptly and it's hardly an edge case, it's a serious issue.
Vote by External U.
18781 | July 15, 2014 03:05:31 AM GMT
Need to add support for method chain where one of the function name is one of the ColdFusion special keys like is, contains, EQ etc.
Comment by Awdhesh K.
18777 | December 03, 2014 05:11:00 AM GMT
Verified, this still exists in ColdFusion 10. needed for braintree payments integration
Vote by External U.
18782 | March 24, 2016 08:39:17 AM GMT
Verified, this still exists in ColdFusion 2016. needed for braintree payments integration
Vote by Daniel S.
29786 | October 14, 2018 05:37:19 AM GMT