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.