[seam-issues] [JBoss JIRA] Updated: (SEAMSECURITY-80) NullPointer in org.jboss.seam.security.external.OpenIdPrincipalImpl.getAttribute(OpenIdPrincipalImpl.java:48) when there is no value for given alias.

Marek Smigielski (JIRA) jira-events at lists.jboss.org
Thu Jun 23 13:07:23 EDT 2011


     [ https://issues.jboss.org/browse/SEAMSECURITY-80?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marek Smigielski updated SEAMSECURITY-80:
-----------------------------------------

          Git Pull Request: https://github.com/seam/security/pull/19  (was: https://github.com/seam/security/pull/18)
    Workaround Description: 
implement private method:

    private  String getAttribute(String alias,Map<String, List<String>> attributeValues) {
        if (attributeValues == null) return null;

        List<String> values = attributeValues.get(alias);
        if (values==null||values.size() == 0) {
            return null;
        } else if (values.size() == 1) {
            return (String) attributeValues.get(alias).get(0);
        } else {
            throw new RuntimeException("Attribute has multiple values");
        }
    }


and use it like that:

        this.email = getAttribute("email",principal.getAttributeValues());


  was:
implement private method:

    private  String getAttribute(String alias,Map<String, List<String>> attributeValues) {
        if (attributeValues == null) return null;

        List<String> values = attributeValues.get(alias);
        if (values!=null&&values.size() == 0) {
            return null;
        } else if (values.size() == 1) {
            return (String) attributeValues.get(alias).get(0);
        } else {
            throw new RuntimeException("Attribute has multiple values");
        }
    }


and use it like that:

        this.email = getAttribute("email",principal.getAttributeValues());




> NullPointer in org.jboss.seam.security.external.OpenIdPrincipalImpl.getAttribute(OpenIdPrincipalImpl.java:48)  when there is no value for given alias.
> ------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SEAMSECURITY-80
>                 URL: https://issues.jboss.org/browse/SEAMSECURITY-80
>             Project: Seam Security
>          Issue Type: Bug
>            Reporter: Marek Smigielski
>
> NullPointer in org.jboss.seam.security.external.OpenIdPrincipalImpl.getAttribute(OpenIdPrincipalImpl.java:48)  when there is no value for given alias.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list