struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4932) Conversion fails when generic type is an interface
Date Fri, 18 May 2018 14:36:00 GMT

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

ASF GitHub Bot commented on WW-4932:
------------------------------------

yasserzamani opened a new pull request #221:  WW-4932 honor .properties file before the generic
parametrics
URL: https://github.com/apache/struts/pull/221
 
 
   I think it's better to honor .properties file (where element class has been defined strictly
by user) before the generic parametrics.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Conversion fails when generic type is an interface
> --------------------------------------------------
>
>                 Key: WW-4932
>                 URL: https://issues.apache.org/jira/browse/WW-4932
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other
>            Reporter: Nuno Oliveira
>            Assignee: Yasser Zamani
>            Priority: Minor
>             Fix For: 2.6
>
>
> Hi, I was asked to create this issue after exchanging some emails in the struts mailing
list.
> I had the following problem:
> {noformat}
> Hi,
> I am having problems populating an action variable Set by request using
> struts type conversion if the Set has the element type defined as an
> interface.
> I have a UserAction-conversion.properties file with the following
> configuration using the class implementation:
> KeyProperty_roles=id
> Element_roles=path.to.class.Roles
> CreateIfNull_roles=true
> And UserAction has the collection Set<RolesInterface>. Roles obviously
> implements RolesInterface.
> If the Set element type <RolesInterface> is deleted it works just fine.
> Am I doing something wrong or is this not possible?
> Thanks{noformat}
> And this was the response, which fixed my problem. :
> {noformat}
> I reproduced it and seems it's because it tries to instantiate a new
> element but the interface cannot being instantiated. Please see [1] to
> know why it tries to instantiate interface instead of class.
> Annotating the getRoles or setRoles method with @Element(value =
> path.to.class.Roles.class) may fix this issue. (shouldn't it be
> path.to.class.Role instead? it seems Roles is a list not element)
> Regards.
> [1]
> github.com/apache/struts/blob/05829e3faadd15cfa67eb234cd1775f2b98918cb/core/src/main/java/com/opensymphony/xwork2/conversion/impl/DefaultObjectTypeDeterminer.java#L100{noformat}
> After acknowledging the issue is fixed, the fix suggestion:
> {noformat}
> You're welcome :) glad to hear this. However, I think it's better that
> Struts honor .properties file (where element class has been defined
> strictly by user) before the generic parametrics [1]. Could you please
> register an issue at [2] with title "conversion fails when generic type
> is an interface" then paste these emails contents in it's description.
> Thanks for your report!
> [1]
> github.com/apache/struts/blob/05829e3faadd15cfa67eb234cd1775f2b98918cb/core/src/main/java/com/opensymphony/xwork2/conversion/impl/DefaultObjectTypeDeterminer.java#L100
> [2] issues.apache.org/jira/projects/WW/
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message