On 3/5/06, Sean Corfield <[EMAIL PROTECTED]> wrote:
> Having spent a little more time digging in the code, I think the root
> problem is philosophical
And on the subject of philosophy:
Error Occurred While Processing Request
Not including a return type in cfc method declarations is considered
bad practice and is not allowed by coldspring.aop !!
The error occurred in
/home/eclipse/workspace/coldspring/aop/framework/AopProxyUtils.cfc:
line 273
Called from /home/eclipse/workspace/coldspring/aop/framework/AopProxyUtils.cfc:
line 226
Called from
/home/eclipse/workspace/coldspring/aop/framework/ProxyFactoryBean.cfc:
line 161
Called from
/home/eclipse/workspace/coldspring/aop/framework/ProxyFactoryBean.cfc:
line 111
Called from /home/eclipse/workspace/coldspring/beans/BeanDefinition.cfc:
line 422
Called from /home/eclipse/workspace/coldspring/beans/DefaultXmlBeanFactory.cfc:
line 300
Called from /home/eclipse/workspace/ModelGlue/ModelGlue/ModelGlue.cfc: line 168
Called from /home/eclipse/workspace/ModelGlue/ModelGlue/ModelGlue.cfc: line 88
Called from
/home/eclipse/workspace/ModelGlue/ModelGlue/Core/XMLModelGlueLoader.cfc:
line 48
Called from /home/eclipse/workspace/ModelGlue/ModelGlue/ModelGlue.cfm: line 12
Called from /Library/WebServer/Documents/ggcc10/Application.cfm: line 10
I remember discussing this with Chris a while back and saying that
returntype= should be present but now, with the prevalence of duck
typing and some of the generated / injected code we're seeing, I'm no
longer convinced.
I modified AopProxyUtils.cfc to treat a missing returntype as "any"
(and where it tests for "void" before generating the return code, it
also needs to test whether returntype is missing).
Here's a patch of what I changed locally, just FYI:
Index: AopProxyUtils.cfc
===================================================================
RCS file: /coldspring/coldspring/aop/framework/AopProxyUtils.cfc,v
retrieving revision 1.11
diff -u -r1.11 AopProxyUtils.cfc
--- AopProxyUtils.cfc 28 Jan 2006 21:44:14 -0000 1.11
+++ AopProxyUtils.cfc 5 Mar 2006 22:15:37 -0000
@@ -270,7 +270,8 @@
<cfelseif StructKeyExists(metaData,'returntype')>
<cfset function = function & " returntype=""" &
metaData.returntype & """" />
<cfelse>
- <cfthrow type="coldspring.aop.BadProgrammingError"
message="Not
including a return type in cfc method declarations is considered bad
practice and is not allowed by coldspring.aop !!" />
+ <cfset function = function & " returntype=""any""" />
+ <!--- cfthrow type="coldspring.aop.BadProgrammingError"
message="Not including a return type in cfc method declarations is
considered bad practice and is not allowed by coldspring.aop !!" /
--->
</cfif>
<cfif StructKeyExists(metaData,'output')>
<cfset function = function & " output=""" &
metaData.output & """" />
@@ -297,7 +298,7 @@
<cfset function = function & "<cfset var rtn = callMethod('" &
metaData.name & "', arguments) />" & Chr(10) />
<!--- return a value if we need to --->
- <cfif not FindNoCase('void',metaData.returnType)>
+ <cfif structKeyExists(metaData,'returnType') and not
FindNoCase('void',metaData.returnType)>
<cfset function = function & "<cfif
isDefined('rtn')><cfreturn rtn
/></cfif>" & Chr(10) />
</cfif>
<!--- close function --->
--
Sean A Corfield -- http://corfield.org/
Got frameworks?
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood