From: Lane S. <la...@op...> - 2003-04-29 07:23:28
|
Keats wrote: > An update on a cold thread ... > > In playing around with the XmlDemo, I thought I had re-encountered > this elusive bug. But then I realized the reason ... > > I tried to do something like: > > #set $jdomElement.AttributeValue.Thinga = "mabob" > > and I got a NullPointerException. After looking at the > PropertyOperator code, the problem was suddenly obvious. WM will > always look for a "unary accessor" before a "binary mutator". In this > case, it finds a getAttribute() method, which happens to return null, > hence the NPE. did you mean getAttributeValue() and not getAttribute() relative to your code? > > > Perhaps this is the problem Marc was seeing? > > Anyway, it's not clear to me how to "fix" this. > > We could catch the exception and then look for a binary mutator before > throwing. But this could result in inconsistent behavior. For > example, in the above case, if the attribute "Thinga" did exist, you > would get an error, since you can't assign a String to a JDOM > Attribute field. > > Alternatively, we could always check for the "binary mutator" first. > This makes some sense, but there are issues here as well. It would > break backwards compatability for anyone relying on the unary-first > behavior. This probably wouldn't effect many templates, but if it did > it could be a puzzling error. It also might have performance > implications. > > My feeling is that we should just document the behavior and live with > it. But if anyone feels strongly that this is bad, I'm open to > persuasion. > > Keats > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Webmacro-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webmacro-devel > |