From: Keats K. <kea...@na...> - 2003-03-30 00:16:26
|
Strangely I can't reproduce this error on my home machine. I created some tests and added them to the test/unit org.webmacro.template.TestGetSet class and everything seems to be working. Could this be a platform specific problem? I'm running WinXP Home with Sun's JDK 1.4.1_01 at home. At the office I have Win2K and a similar JDK version. If other folks could try this test on different platforms I'd appreciated it. Keats kea...@na... wrote: > Marc, > > I think I have finally tracked this one down. > > Line 781 in PropertyOperatorCache.java, in the > PropertyOperatorCache.PropertyOperator.setProperty() method: > > parent = getProperty(context, instance, names, pos, pos); > > should be: > > parent = getProperty(context, instance, names, pos, pos + > 1); > > Don't ask me to explain this (I can't). I'm guessing that this bug > has been in the code forever. I suppose not many people have tried to > use the binary mutator syntax, i.e., > > #set $obj.Prop.Key = "value" > > for > > $obj.setProp("Key", "value") > > Anyway, I'll try to write some unit tests for this and make sure it > doesn't break anything before committing the change. > > Keats > > > > > -----Original Message----- > > From: Marc Palmer [mailto:ma...@an...] > > Sent: Wednesday, March 19, 2003 10:19 PM > > To: web...@li... > > Subject: [Webmacro-devel] Binary accessor "set" problem > > > > > > > > Hi all, > > > > I'm working against WM 1.1 final source, developing this WM > > "run and go" > > webapp currently codenamed "WebMacro Ignition". > > > > I've come across a funny. I can't -set-a property that has a binary > > accessor. A glance over the WM source for this > > (PropertyOperatorCache) has > > not enlightened me and the laptop I'm using is just toooo slow for > > interactive debug against Tomcat at the mo. > > > > Anyway, I'm getting this error in my template: > > > > Ignition encountered an error while executing a template: > > FileTemplate:C:\Program Files\Apache Group\Tomcat > > 4.1\webapps\ignition\WEB- > > INF\classes\index.wm: > > org.webmacro.PropertyException$NoSuchPropertyException: No > > public property > > Parameters on variable $action of class > > org.webmacro.ignition.api.action.ActionParams at C:\Program > > Files\Apache > > Group\Tomcat 4.1\webapps\ignition\WEB-INF\classes\index.wm:17.2 > > > > The part of the template causing offence is: > > > > #set $action.Parameters.Template = "itworked.wm" > > > > ...and $action is of type ActionParams which has the > > following methods: > > > > public void setParameters(String key, Object value) > > > > public String getParameters(String key) > > > > ... I know binary accessor "get" works as have used it > > elsewhere but this > > is the first time I've tried to "set" using it. > > > > Also, while binary accessor is certainly a convenience I'm > > starting to > > wonder whether it is a bit of an abomination. i.e. you cannot > > rewrite my > > previous bit of WM script as this: > > > > #set $params = $action.Parameters > > #set $params.Template = "itworked.wm" > > > > Well... you could if there was a "proxy" created to represent > > the virtual > > field "Parameters" internally in WM that handled this but it would be > > pretty nasty. Granted many web developers would not think of > > doing this, > > but it disturbs me that we can get ourselves into an > > inconsistent situation > > by using binary accessors. I think I may stop using them > > having realised > > this. > > > > $0.02 > > > <snip> > |