[ 
https://issues.apache.org/jira/browse/DIRSERVER-2231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16424112#comment-16424112
 ] 

Emmanuel Lecharny commented on DIRSERVER-2231:
----------------------------------------------

You are absolutely right.

The code should looks like :

{code:java}
...
        Dn dn = null;
        
        try
        {
            rwLock.readLock().lock();

            if ( entryDnCache != null )
            {
                Element el = entryDnCache.get( id );
                
                if ( el != null )
                {
                    return ( Dn ) el.getObjectValue();
                }
            }
...
{code}

> NPE in AbstractBTreePartition when cacheService is not used
> -----------------------------------------------------------
>
>                 Key: DIRSERVER-2231
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-2231
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.0.0-M24
>            Reporter: Jan Kalina
>            Priority: Major
>
> When trying to use DirectoryService without cacheService, following 
> NullPointerException occure:
> {code}
> java.lang.NullPointerException
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.buildEntryDn(AbstractBTreePartition.java:2606)
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.fetch(AbstractBTreePartition.java:1424)
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.saveContextCsn(AbstractBTreePartition.java:3636)
> org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.lookup(AbstractBTreePartition.java:1393)
> org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.lookup(DefaultPartitionNexus.java:464)
> org.apache.directory.server.core.exception.ExceptionInterceptor.add(ExceptionInterceptor.java:160)
> org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:341)
> org.apache.directory.server.core.admin.AdministrativePointInterceptor.add(AdministrativePointInterceptor.java:1189)
> org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:341)
> org.apache.directory.server.core.authz.AciAuthorizationInterceptor.add(AciAuthorizationInterceptor.java:518)
> org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:341)
> org.apache.directory.server.core.referral.ReferralInterceptor.add(ReferralInterceptor.java:247)
> org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:341)
> org.apache.directory.server.core.authn.AuthenticationInterceptor.add(AuthenticationInterceptor.java:335)
> org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:341)
> org.apache.directory.server.core.normalization.NormalizationInterceptor.add(NormalizationInterceptor.java:131)
> org.apache.directory.server.core.DefaultOperationManager.add(DefaultOperationManager.java:397)
> org.apache.directory.server.core.shared.DefaultCoreSession.add(DefaultCoreSession.java:211)
> org.apache.directory.server.core.shared.DefaultCoreSession.add(DefaultCoreSession.java:188)
> org.wildfly.security.sasl.gssapi.TestKDC.startDirectoryService(TestKDC.java:104)
> {code}
> From source it looks null entryDnCache should be supported, as there is 
> condition for null cacheService:
> https://github.com/apache/directory-server/blob/2.0.0-M24/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java#L600



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to