I'm using CAS server 3.4.2 and LdapServiceRegistryDao to store the services
management configuration in an LDAP store (OpenDS Directory Server 2.2.0).

After saving a service with an empty set of allowed attributes, I get a
NullPointerException when loading the services list again:

----------- snip ------------
2010-06-01 16:37:29,228 ERROR
[org.jasig.cas.adaptors.ldap.services.LdapServiceRegistryDao] - Exception
while loading Registered Services from LDAP Directory...
java.lang.NullPointerException
        at java.util.Arrays$ArrayList.<init>(Arrays.java:3357)
        at java.util.Arrays.asList(Arrays.java:3343)
        at
org.jasig.cas.adaptors.ldap.services.DefaultLdapServiceMapper.doMapFromContext(DefaultLdapServiceMapper.java:74)
...
----------- snap ------------

I already came up with a fix for this. This line ...

  
s.setAllowedAttributes(Arrays.asList(ctx.getStringAttributes(this.serviceAllowedAttributesAttribute)));

.. has to be replaced with a safer version like this:

        String[] allowedAttributes =
ctx.getStringAttributes(this.serviceAllowedAttributesAttribute);
        if ( allowedAttributes != null ) {
                s.setAllowedAttributes(Arrays.asList(allowedAttributes));
        } else {
                s.setAllowedAttributes( new ArrayList<String>() );
        }

What to do next? Shall I create a JIRA ticket or can someone else put this
in the codebase?

Best wishes,
Tobias Trelle



-- 
View this message in context: 
http://jasig.275507.n4.nabble.com/NPE-in-org-jasig-cas-adaptors-ldap-services-DefaultLdapServiceMapper-tp2238617p2238617.html
Sent from the CAS Developers mailing list archive at Nabble.com.

-- 
You are currently subscribed to cas-dev@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-dev

Reply via email to