You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Andrew Swan (JIRA)" <ji...@apache.org> on 2010/10/26 06:53:20 UTC

[jira] Created: (DIRSERVER-1576) DefaultDirectoryService uses Set operations on Partitions that don't implement equals

DefaultDirectoryService uses Set operations on Partitions that don't implement equals
-------------------------------------------------------------------------------------

                 Key: DIRSERVER-1576
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1576
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: core
    Affects Versions: 1.5.7
            Reporter: Andrew Swan
            Priority: Minor


org.apache.directory.server.core.DefaultDirectoryService performs both "add" and "remove" operations on Sets of Partitions, however because most of the concrete Partition classes don't override equals, these operations don't work as you might expect. The Set should be changed to a Collection or Map, with addition or removal being based on whether any element contains the same suffix DN as the one being added or removed. This would avoid stack traces like this one:

javax.naming.ConfigurationException: ERR_263 Duplicate partition suffix: 0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=
com
        at org.apache.directory.server.core.partition.DefaultPartitionNexus.addContextPartition(DefaultPartitionNexus.java:911)
        at org.apache.directory.server.core.partition.DefaultPartitionNexus.doInit(DefaultPartitionNexus.java:245)
        at org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:65)
        at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1437)
        at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:907)
        at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.build(DefaultDirectoryServiceFactory.java:215)
        at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.init(DefaultDirectoryServiceFactory.java:114)
        at org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:172)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)

The workaround in the above case is for the caller of DirectoryService#addPartition to first check whether the Set returned by DirectoryService#getPartitions already contains a partition with the suffix being added. This duplication check should of course be encapsulated within the DirectoryService.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1576) DefaultDirectoryService uses Set operations on Partitions that don't implement equals

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924874#action_12924874 ] 

Emmanuel Lecharny commented on DIRSERVER-1576:
----------------------------------------------

Thanks for the report. We will have a look at it as we are currently reviewing this part of the code.

> DefaultDirectoryService uses Set operations on Partitions that don't implement equals
> -------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-1576
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1576
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.7
>            Reporter: Andrew Swan
>            Priority: Minor
>
> org.apache.directory.server.core.DefaultDirectoryService performs both "add" and "remove" operations on Sets of Partitions, however because most of the concrete Partition classes don't override equals, these operations don't work as you might expect. The Set should be changed to a Collection or Map, with addition or removal being based on whether any element contains the same suffix DN as the one being added or removed. This would avoid stack traces like this one:
> javax.naming.ConfigurationException: ERR_263 Duplicate partition suffix: 0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=
> com
>         at org.apache.directory.server.core.partition.DefaultPartitionNexus.addContextPartition(DefaultPartitionNexus.java:911)
>         at org.apache.directory.server.core.partition.DefaultPartitionNexus.doInit(DefaultPartitionNexus.java:245)
>         at org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:65)
>         at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1437)
>         at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:907)
>         at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.build(DefaultDirectoryServiceFactory.java:215)
>         at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.init(DefaultDirectoryServiceFactory.java:114)
>         at org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:172)
>         at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> The workaround in the above case is for the caller of DirectoryService#addPartition to first check whether the Set returned by DirectoryService#getPartitions already contains a partition with the suffix being added. This duplication check should of course be encapsulated within the DirectoryService.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Resolved] (DIRSERVER-1576) DefaultDirectoryService uses Set operations on Partitions that don't implement equals

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRSERVER-1576.
------------------------------------------

    Resolution: Fixed

Applied a patch that check that the backend is correctly updated before updating the set. : http://svn.apache.org/viewvc?rev=1133725&view=rev


> DefaultDirectoryService uses Set operations on Partitions that don't implement equals
> -------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-1576
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1576
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.7
>            Reporter: Andrew Swan
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> org.apache.directory.server.core.DefaultDirectoryService performs both "add" and "remove" operations on Sets of Partitions, however because most of the concrete Partition classes don't override equals, these operations don't work as you might expect. The Set should be changed to a Collection or Map, with addition or removal being based on whether any element contains the same suffix DN as the one being added or removed. This would avoid stack traces like this one:
> javax.naming.ConfigurationException: ERR_263 Duplicate partition suffix: 0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=
> com
>         at org.apache.directory.server.core.partition.DefaultPartitionNexus.addContextPartition(DefaultPartitionNexus.java:911)
>         at org.apache.directory.server.core.partition.DefaultPartitionNexus.doInit(DefaultPartitionNexus.java:245)
>         at org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:65)
>         at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1437)
>         at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:907)
>         at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.build(DefaultDirectoryServiceFactory.java:215)
>         at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.init(DefaultDirectoryServiceFactory.java:114)
>         at org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:172)
>         at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> The workaround in the above case is for the caller of DirectoryService#addPartition to first check whether the Set returned by DirectoryService#getPartitions already contains a partition with the suffix being added. This duplication check should of course be encapsulated within the DirectoryService.

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

[jira] Updated: (DIRSERVER-1576) DefaultDirectoryService uses Set operations on Partitions that don't implement equals

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRSERVER-1576:
-----------------------------------------

    Fix Version/s: 2.0.0-RC1

> DefaultDirectoryService uses Set operations on Partitions that don't implement equals
> -------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-1576
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1576
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.7
>            Reporter: Andrew Swan
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> org.apache.directory.server.core.DefaultDirectoryService performs both "add" and "remove" operations on Sets of Partitions, however because most of the concrete Partition classes don't override equals, these operations don't work as you might expect. The Set should be changed to a Collection or Map, with addition or removal being based on whether any element contains the same suffix DN as the one being added or removed. This would avoid stack traces like this one:
> javax.naming.ConfigurationException: ERR_263 Duplicate partition suffix: 0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=
> com
>         at org.apache.directory.server.core.partition.DefaultPartitionNexus.addContextPartition(DefaultPartitionNexus.java:911)
>         at org.apache.directory.server.core.partition.DefaultPartitionNexus.doInit(DefaultPartitionNexus.java:245)
>         at org.apache.directory.server.core.partition.AbstractPartition.initialize(AbstractPartition.java:65)
>         at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1437)
>         at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:907)
>         at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.build(DefaultDirectoryServiceFactory.java:215)
>         at org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory.init(DefaultDirectoryServiceFactory.java:114)
>         at org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:172)
>         at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> The workaround in the above case is for the caller of DirectoryService#addPartition to first check whether the Set returned by DirectoryService#getPartitions already contains a partition with the suffix being added. This duplication check should of course be encapsulated within the DirectoryService.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.