tracker issue : CF-3043970

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

Bug 87045:(Watson Migration Closure)The <cfthrow> tag allows use of an attributeCollection, but the equivalent script method, throw(), throws an exception if you try to use an argumentCollection with it

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Adam Tuttle / Adam Tuttle (Adam Tuttle)

Created: 08/16/2011

Components: Language, CFSCRIPT

Versions: 9.0.1

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Normal / Most users will encounter

Locale/System: English / Platforms All

Vote Count: 4

Problem:

The <cfthrow> tag allows use of an attributeCollection, but the equivalent script method, throw(), throws an exception if you try to use an argumentCollection with it. This should be included, not only for feature parity, but also because it just plain makes sense.
Method:

local.args = { message = "this is a test exception" };throw(argumentCollection=local.args);
Result:

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

Watson Bug ID:	3043970

External Customer Info:
External Company:  
External Customer Name: Adam Tuttle
External Customer Email: 71DA001D4586B5B5992015D5
External Test Config: 08/16/2011

Attachments:

Comments:

This bug has been voted..
Vote by External U.
21022 | November 11, 2011 07:31:08 AM GMT
+1. Each of the tag-based or script-based implementations of any functionality should be analogous where possible. Just as a matter of course. -- Adam
Vote by External U.
21023 | November 11, 2011 07:31:09 AM GMT
This bug has been voted..
Vote by External U.
21024 | November 11, 2011 07:31:10 AM GMT
Check this could have been fixed..
Comment by Awdhesh K.
21016 | November 02, 2014 11:21:03 PM GMT
This bug is not fixed. added the test case.
Comment by Suchika S.
21017 | December 04, 2014 08:02:03 AM GMT
We are reusing the attributeCollection key only rather than argumentCollection. Try as follow local.args = { message = "this is a test exception" };throw(attributeCollection=local.args);
Comment by Awdhesh K.
21018 | December 04, 2014 08:44:20 AM GMT
This is _not_ fixed. It is no longer a tag, and therefore attributeCollection is inappropriate. If you make a function out of something, it needs to behave like a function. It's not our fault that your general-purpose solution does the wrong thing.
Comment by External U.
21019 | December 16, 2014 09:28:43 AM GMT
I agree with my namesake. "attribute collection" is a tag conceit. throw() is not a tag, ergo it should not use attributecollection. That said, built-in CFML functions won't accept an argument collection either. So unless you're going to make ALL built-in functions accept argument collections (which would be another ticket which I think I have already raised), adding this functionality to ONE "function" would be the wrong thing to do anyhow. You Adobe guys really don't know what you're doing, vis-a-vis language design, do you?
Comment by External U.
21020 | December 16, 2014 09:37:26 AM GMT
So... this is marked "ToFix" but as of 2016-04-11, this behavior is still in place for many/all of the tags-implemented-as-components. I just encountered this same behavior with the mail component which is supposed to support all of the same attributes as the CFMAIL tag but does not support "attributeCollection". Use of the attributeCollection approach to invocation makes usage far more flexible (e.g, in situations where sometimes some attributes like BCC are needed and in others they are not), and having parity between the CFMAIL and mail component make migrating tag-based code to script much simpler. In looking at mail.cfc shipped with CF11, this is literally a 6-line fix to make both the init() and send() methods support attributeCollection. Please move forward with the "ToFix" status of this bug for all such tag-as-component implementations.
Comment by External U.
21021 | April 11, 2016 02:46:44 PM GMT
Please move forward with fixing this, per the "ToFix" status, for all all tags implemented as components for use in script.
Vote by External U.
21025 | April 11, 2016 02:47:50 PM GMT