Hi Jonathan, StructDelete() doesn't throw an error if key is not found in the struct, the error you are seeing is from StructFind(). What do you see if you cfdump args and then abort before structfind?
Chris 2009/12/13 Jonathan Logue <[email protected]> > I decided to take a look at Gesture this evening and ran into an > issue. I have a controller method that was working in MG Unity on both > CF7 and CF9 and busts using Gesture. I am using ColdSpring 1.2. > > I have tried a lot of different things leading to completely gutting > my method to what you see below. > > <cffunction name="getObjectsByClass" returnType="WEB- > INF.cftags.component"> > <cfargument name="event" type="WEB-INF.cftags.component"> > > <cfset var args = arguments.event.getAllArguments() /> > <cfset var class = structFind(args,'class') /> > <cfset structDelete(args,'class') /> > <cfabort /> > > <cfreturn arguments.event /> > </cffunction> > > Error: coldfusion.runtime.IllegalStructAccessException: Cannot find > class key in structure. at coldfusion.runtime. > Struct.StructFind(Struct.java:278) at coldfusion.runtime. > > The code above works on the same request that I "init" the application > but errors on any subsequent request. It works if I remove the > structDelete() call. It also works if I use the duplicate() method to > copy the arguments structure... I could just implement this, but I > would like to understand what is going on. It occurred to me that > "class" could be reserved, so I modified the variable name and > continued to receive the error. I also reproduced this behavior in the > sample hello world app. I have run several experiments independent of > the framework and have not been able to reproduce which is why I am > posting here in the MG group. > > This works in a simple cfm page: > > <cfset arguments = {class='someclass',returnVariable='myreturnvar'} /> > <cfset args = arguments /> > <cfset _class = structFind(args,'class') /> > <cfset structDelete(args,'class') /> > <cfdump var="#args#"> > <cfdump var="#_class#"> > > Any insight is appreciated! > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<model-glue%[email protected]> > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en > -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en
