Patch submitted for bug https://issues.apache.org/struts/browse/WW-2170.
Thanks for confirming the bug Don. aaron -----Original Message----- From: Don Brown [mailto:[EMAIL PROTECTED] Sent: Monday, September 10, 2007 10:51 PM To: Struts Users Mailing List Subject: Re: ObjectFactory.buildResult not correctly configuring Result instance properties This is a bug and will definitely be fixed for 2.1, although I think we should do something for 2.0.11. Patches are always welcome... :) Don On 9/11/07, Aaron Brown <[EMAIL PROTECTED]> wrote: > Hi, I think I have stumbled across a bug in the ObjectFactory. Has > anyone else noticed the following behavior? > > ObjectFactory.buildResult() invokes OgnlUtil.setProperties() to populate > a Result instance with a parameter map. In addition, the call to > OgnlUtil.setProperties forces exceptions to be thrown when necessary. If > an exception is thrown, it is caught by the ObjectFactory and logged > with a level of DEBUG. Further, in the ObjectFactory.buildResult() > method the following comment appears: "ognl exceptions could be thrown > and be ok if, for example, the result uses parameters in ways other than > as properties for the result object." > > However, throwing exceptions is not ok. The Ognl.setProperties method > will stop execution if an exception is thrown. As such, it is possible > that not all properties specified in the ResultConfig parameter map will > be set on the Result instance. > > For example, I am trying to set a property on a JSONResult class. > However, the ResultConfig parameter map has a 'location' property in > addition to the property in my Result action annotation. This property > is the first thing that is set, yet an error is thrown. The rest of the > properties in the map are ignored and the Result class is incorrectly > configured. > > If all you want to do is log an erroneous attempt to set a property, why > are you throwing exceptions? The OgnlUtil.internalSetProperty class will > do that for you if it told not to throw exceptions. > > Thanks, > Aaron brown > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]