Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-1576

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5.7
    • 2.0.0-M1
    • core
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.s Andrew Swan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: