First of all, since I'm Mach-II newbie, feel free to take my
suggestions with a grain of salt, as I'm just peeking through a hole
and may very well be missing big picture.

Now, when working with ORM, I don't agree that all getters should
return defaults. My bean is now representing data definition, so,
default may be not preferable. Like, I would not prefer my primary key
to default to 0, because that is not correct data definition. Same
goes for a string, where blank and null are 2 distinct values.

I'm definitely of the opinion that it's a CF bug because the variable
is disappearing when the value is null. But, give the fact that's how
its been for ages (and not likely to change), what's the solution?

The reason I think IsDefined may work in this case is, because, if the
path is incorrect, we will get a CF error. Since we didn't get an
error from the method invocation, it's safe to assume the variable
"value" will be available. At this point the only reason the variable
"value" will be undefined is because of the CF bug.

Thanks,
Sumit


On Oct 15, 4:56 pm, "Peter J. Farrell" <[email protected]> wrote:
> Well, in a bean all getters should return a value. I'd be hestitant to allow 
> "" (zero-length string) as a valid value.  This comes down that beans should 
> be init'ed when instantiated with no-argument constructor meaning all getters 
> should return defaults - not null. It is just that if you provide a path to 
> elements bound to a CFC -- I think it is reasonable for the framework to 
> expect the path to be valid. Also, I fear that a simple mistake in a path 
> could open a security hole if we soft fail as you suggest.
>
> Thanks for bringing this up. Please don't think that I'm being negative on 
> your suggestion -- I really do appreciate it and it's really cool you're 
> digging into the framework code to figure out what is going wrong. Certainly 
> makes debugging easier and certainly makes the decision process on a fix 
> faster. Keep 'em coming.
>
> FYI, the latest version of the framework includes new exception in regards to 
> missing getters or getters that fail to return data. This was added yesterday 
> although I think it could use some additional shoring up.
>
> .Peter
>
> -----Original Message-----
> From: Sumit Verma <[email protected]>
> Date: Thu, 15 Oct 2009 13:15:01
> To: Mach-II for CFML<[email protected]>
> Subject: [Mach-II] Error in formTagBuilder.cfm
>
> Hey Guys,
>
> Found a bug in Mach-II 1.8/CF9. In formTagBuilder.cfm, line 81 invokes
> the getter for an item in bean.
>
> <cfinvoke component="#arguments.bind#" method="get#key#"
> returnvariable="value" />
>
> And then it returns the "value" on line 104.
>
> When using this with ORM in CF9, unless you have default values
> defined for the item, method returns null, in which case "value"
> becomes undefined. IMHO, CF should not wipe out the variables but let
> the value be "undefined", but CF doesn't really have a concept of
> "null" or "undefined".
>
> So, the solution would be to check the existance of variable "value"
> before returning it.
>
> ColdFusion 9:
>
> <cfif IsNull(value)>
>         <cfset value = "" />
> </cfif>
>
> Or, to keep it backword compatible:
>
> <cfif Not IsDefined("value")>
>         <cfset value = "" />
> </cfif>
>
> Thoughts?
>
> Sumit
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to Mach-II for CFML list.
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/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets: 
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
-~----------~----~----~----~------~----~------~--~---

Reply via email to