[ 
https://issues.apache.org/jira/browse/FC-107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shawn McKinney resolved FC-107.
-------------------------------
    Resolution: Fixed

> very dubious code in RoleDAO.update(Role)
> -----------------------------------------
>
>                 Key: FC-107
>                 URL: https://issues.apache.org/jira/browse/FC-107
>             Project: FORTRESS
>          Issue Type: Bug
>    Affects Versions: 1.0.0-RC40
>            Reporter: Emmanuel Lecharny
>
> While cleaning some of the Sonar issue, I found some piece of code that I 
> think is, at best, dubious, in {{RoleDAO.update(Role) }}, line 204 :
> {code}
>             if ( VUtil.isNotNullOrEmpty( entity.getOccupants() ) )
>             {
>                 for ( String name : entity.getOccupants() )
>                 {
>                     mods.add( new DefaultModification( 
> ModificationOperation.REPLACE_ATTRIBUTE,
>                         SchemaConstants.ROLE_OCCUPANT_AT, 
> entity.getOccupants().toArray( new String[]
>                             {} ) ) );
>                 }
>             }
> {code}
> The {{name}} variable is never used, and this will create as many 
> modifications as we have names in the list. It will work, but here, tehre are 
> two options :
> - either it's just an ineffective way of doing that, as the loop is useless
> - or there is something missing, like using the name for some purpose.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to