On Fri, Jul 31, 2009 at 8:48 AM, Peter
Phillips<petergphill...@googlemail.com> wrote:
> I recently upgraded from struts 2.0 to 2.1.7 and noticed that we are
> now getting lots of warnings in the logs:
>
> 12:31:53,283 WARN  [OgnlValueStack] Error setting expression
> 'button.save' with value '[Ljava.lang.String;@1683e9f'
> ognl.OgnlException: target is null for setProperty(null, "save",
> [Ljava.lang.String;@1683e9f)
>        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651)
>        at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>        at ognl.SimpleNode.setValue(SimpleNode.java:246)
>        at ognl.ASTChain.setValueBody(ASTChain.java:172)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>        at ognl.SimpleNode.setValue(SimpleNode.java:246)
>        at ognl.Ognl.setValue(Ognl.java:476)
>        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
>        at 
> com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:161)
>
> In our case the jsp has a submit button - <s:submit key="button.save" />.
>
> Our action doesn't have a button.save property, I could add one to
> suppress the warning but it doesn't feel right to add code to an
> action to prevent a warning in the logs.  Alternatively I guess I
> could change the log4j settings so that OgnlValueStack was set to
> ERROR, but this would stop other warnings that I might actually be
> interested in.
>
> XW-613 changed the logging levels for the class from debug to warning
> in a few places.  However reading the bug report by Brian Pontarelli
> in XW-613 his issue seems to be the lack of warning logging when
> exceptions are caught - which in my mind is more in the method
> logLookupFailure (lines 353-359).  I agree that this is an exception
> that the user should be warned about, whereas at present it is only a
> debug (if devMode is false).
>
> How are other people getting round the problem with submit buttons
> causing warnings in the logs?
>


/sigh... This is one of the great debates of struts2 development. On
one side you have a camp that wants to know any time a parameter is
submitted that doesn't have a matching getter/setter on the action, on
the other side, you have a group that doesn't want a bunch of errors
in the log. IMO, I get around it by setting the logging level
differently from dev to production. The problem is a bit basic in it's
nature, the current mechanisms for parameter parsing using OGNL to set
values against the action class. OGNL will throw an exception if a
passed parameter does not match a property on the target action.
Obviously, not all situations warrant a property on the target action,
but at the same time, when you are developing your application and you
forget a getter/setter on an action, you want to know. We've tried a
few different solutions, including using the value of devMode to
decide whether or not to show the errors, but it seems that there is
no perfect solution. Honestly, I think that if someone wants to help
tackle this issue, go ahead and file a JIRA, but I can say with
confidence that bugs and patches that indiscriminately turn the
exceptions and logging off or on will not be considered.

-Wes


-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to