You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Aysegul Aydin Isiktekin (JIRA)" <je...@portals.apache.org> on 2009/06/10 09:51:07 UTC
[jira] Commented: (JS2-1031) Ldap AttributeBasedRelationDAO class
gets NullPointerException when trying to create a relation between two ldap
entities
[ https://issues.apache.org/jira/browse/JS2-1031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717972#action_12717972 ]
Aysegul Aydin Isiktekin commented on JS2-1031:
----------------------------------------------
Suggested solution to the problem fixes the problem for only multi-valued attributes since if the attribute is not a multi-valued attribute setAttribute method returns without setting the attribute. So for fixing the problem I have written this:
--------------------------------------------
if (relationAttribute == null)
{
fromEntity.setAttribute(this.relationAttribute, new ArrayList<String>());
relationAttribute = fromEntity.getAttribute(this.relationAttribute);
if(relationAttribute == null)
{
fromEntity.setAttribute(this.relationAttribute, attrValue);
relationAttribute = fromEntity.getAttribute(this.relationAttribute);
}
}
--------------------------------------------
It's not a good solution so maybe you should consider a better solution. I need LDAP integration to continue the implementation of our project so i choose quick-and-dirty :)
> Ldap AttributeBasedRelationDAO class gets NullPointerException when trying to create a relation between two ldap entities
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: JS2-1031
> URL: https://issues.apache.org/jira/browse/JS2-1031
> Project: Jetspeed 2
> Issue Type: Bug
> Components: LDAP
> Affects Versions: 2.2.0
> Environment: Windows XP, JRE 1.6.0.11, Tomcat 6.0.18, Apache DS 1.0.2
> Reporter: Aysegul Aydin Isiktekin
>
> 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)
> {
> fromEntity.setAttribute(this.relationAttribute,new ArrayList<String>());
> }
> --------------------------------------------
> to:
> --------------------------------------------
> if (relationAttribute == null)
> {
> fromEntity.setAttribute(this.relationAttribute, new ArrayList<String>());
> relationAttribute = fromEntity.getAttribute(this.relationAttribute);
> }
> --------------------------------------------
> Just setting the attribute leaves relationAttribute NULL, causing the NPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org