Hello,

I've encountered a situation where mach-ii throws an error because coldspring is trying to put the value 0 instead of an object into a listeners' setter. I'm working my way through the coldspring code (BER) to find out why this is happening.

In doing so, I noticed a strange bit of code in the method getBeanFromSingletonCache in DefaultXmlBeanFactory.cfc.
Here's the code:

<cffunction name="getBeanFromSingletonCache" access="public" returntype="any" output="false">
       <cfargument name="beanName" type="string" required="true" />
       <cfset var objRef = 0 />
       <cfset var objExists = true />
<cflock name="bf_#variables.beanFactoryId#.SingletonCache" type="readonly" timeout="5">
           <cfif StructKeyExists(variables.singletonCache, beanName)>
               <cfset objRef = variables.singletonCache[beanName] />
           <cfelse>
               <cfset objExists = true />
           </cfif>
       </cflock>
<cfif not(objExists)>
           <cfif isObject(parent)>
<cfset objRef = variables.parent.getBeanFromSingletonCache(arguments.beanName)>
           <cfelse>
               <cfthrow message="Cache error, #beanName# does not exists">
           </cfif>
       </cfif>
<cfreturn objRef />
   </cffunction>

Now, if you ask me, the variable objExists will never be false, therefore the second part of the function will never be executed.
Just thought I mention it.
Oh, and the component variable 'parent' in DefaultXmlBeanFactory.cfc isn't scoped in about 16 places.

And now I'll just go back figuring out this 0-thing.

Regards,
Ruud


Reply via email to