You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2015/05/20 09:13:00 UTC
[jira] [Created] (FC-107) very dubious code in RoleDAO.update(Role)
Emmanuel Lecharny created FC-107:
------------------------------------
Summary: 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)