Details
Description
AttributeBasedRelationDAO class gets NullPointerException when trying to create a relation between two ldap entities. StackTrace is as follows:
-----------------------------------------------------------------------------------------------------------------------------
SEVERE: Servlet.service() for servlet JetspeedContainer threw exception
java.lang.NullPointerException
at org.apache.jetspeed.security.mapping.ldap.dao.impl.AttributeBasedRelationDAO.internalAddRelation(AttributeBasedRelationDAO.java:165)
at org.apache.jetspeed.security.mapping.ldap.dao.impl.AttributeBasedRelationDAO.addRelation(AttributeBasedRelationDAO.java:230)
at org.apache.jetspeed.security.mapping.ldap.dao.DefaultLDAPEntityManager.addRelation(DefaultLDAPEntityManager.java:88)
at org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLdapAssociationStorageManager.addAssociation(JetspeedPrincipalLdapAssociationStorageManager.java:56)
...more
-----------------------------------------------------------------------------------------------------------------------------
To fix the problem AttributeBasedRelationDAO class line 164 (internalAddRelation method body) should be changed from:
--------------------------------------------
if(relationAttribute == null)
--------------------------------------------
to:
--------------------------------------------
if (relationAttribute == null)
--------------------------------------------
Just setting the attribute leaves relationAttribute NULL, causing the NPE.