You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Rene Gielen (JIRA)" <ji...@apache.org> on 2013/09/18 08:30:57 UTC

[jira] [Commented] (WW-4203) Allow disabling xwork creating null objects on a property level

    [ https://issues.apache.org/jira/browse/WW-4203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770492#comment-13770492 ] 

Rene Gielen commented on WW-4203:
---------------------------------

How about developing and sharing a patch for such a feature?
                
> Allow disabling xwork creating null objects on a property level
> ---------------------------------------------------------------
>
>                 Key: WW-4203
>                 URL: https://issues.apache.org/jira/browse/WW-4203
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: 2.3.15.1, 2.3.15.2
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>              Labels: interceptors, typeconverter, xwork
>             Fix For: 2.3.17
>
>
> Currently, the ParametersInterceptor sets: ReflectionContextState.setCreatingNullObjects(contextMap, true)
> This is great for parameters like "person.name=Phil" since it will create the Person object for you and then set the name.  
> However, sometimes you have a converter for a property that will set it as a whole, and you want to make sure that an empty object is never created.  For example, "person=6", where the Person is set by looking it up by id.  Currently, if someone messed with the url and made it "person[x]=6", XWork would end up creating an empty Person object.  (Something along these lines happened to us and I was looking for a clean way to tell XWork to not allow it)
> Perhaps the TypeConversion annotation could be extended to support this as an additional flag.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira