[jboss-jira] [JBoss JIRA] (ELY-843) Coverity: Logically dead code in PermissionMapperDefinitions (Elytron subsystem)

Josef Cacek (JIRA) issues at jboss.org
Fri Dec 16 07:41:00 EST 2016


Josef Cacek created ELY-843:
-------------------------------

             Summary: Coverity: Logically dead code in PermissionMapperDefinitions (Elytron subsystem)
                 Key: ELY-843
                 URL: https://issues.jboss.org/browse/ELY-843
             Project: WildFly Elytron
          Issue Type: Bug
            Reporter: Josef Cacek
            Assignee: Darran Lofthouse


Coverity static-analysis scan found a logically dead code in the {{PermissionMapperDefinitions.getSimplePermissionMapper}} method.

https://scan7.coverity.com/reports.htm#v16159/p12663/fileInstanceId=6892117&defectInstanceId=1794520&mergedDefectId=1388477
https://scan7.coverity.com/reports.htm#v16159/p12663/fileInstanceId=6892117&defectInstanceId=1794521&mergedDefectId=1388478
Following code
{code:java}
permissionMappings.add(new Mapping(principals != null ? principals : Collections.emptySet(),
        roles != null ? roles : Collections.emptySet(), permissions));
{code}

should rather be
{code:java}
permissionMappings.add(new Mapping(principals, roles, permissions));
{code}

because both {{principals}} and {{roles}} local variables are initialized ({{new HashSet...}}) before this piece of code.




--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list