From: Marc P. <ma...@an...> - 2003-04-29 10:01:51
|
On Tue, 29 Apr 2003 01:44:56 -0400, Keats <ke...@su...> wrote: > 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. > > Perhaps this is the problem Marc was seeing? I don't think so but my memory is fuzzy. My problem was with setting the value, and I don't usually override "setter" methods. I just could never get "set" to work on a binary accessor. However I did get this exact problem you mention yesterday when playing around with some stuff. In short I think that really we should probably look for the most "complex" getter/setter first and go back to unary set/get if nothing found, but this could be a lot more complicated than it sounds. i.e. it should work as you expect it! Keats and I have come unstuck with this and we "know what we're doing". Failing that, or in the interim at least, we should leave it as is but update the binary accessor docs on the site to say "Programmers implementing binary accessor methods should not override getter or setter methods of the same name" or something to that effect. Marc -- Marc Palmer (Wangjammer5) http://www.wangjammers.org Java Consultants |