Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Number of attachments :
Description
Add this to ComponentKeysTestCase if you may, my ssh cvs is still borked. (Are we moving to svn anytime soon?)
public void testComponentKeysFromParentCannotConfuseTheChild() throws Exception
{ DefaultPicoContainer pico = new DefaultPicoContainer(); pico.registerComponentImplementation("test", SimpleTouchable.class); DefaultPicoContainer child = new DefaultPicoContainer(pico); child.registerComponentImplementation("test", DependsOnTouchable.class); DependsOnTouchable dot = (DependsOnTouchable) child.getComponentInstance("test"); assertNotNull(dot); }You will see it breaks, changing one key will fix it. However I feel that parent keys shouldn't be able to break a child container.
The code in question is at CICA:
// we can't depend on ourself
if (adapter.equals(this))
else
{ adapterDependencies.add(adapter); }I'd probably just delete the "else if".
I remember having a discussion with Aslak about unique keys accross the tree but I can't find it in the archive.
Activity
Jörg Schaible
made changes -
Field | Original Value | New Value |
---|---|---|
Environment | ||
Fix Version/s | 1.2 [ 11330 ] |
Jörg Schaible
made changes -
Assignee | Joerg Schaible [ joehni ] |
Jörg Schaible
made changes -
Component/s | PicoContainer (Java) [ 10191 ] |
Paul Hammant
made changes -
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |
Ah whoops I switched to browsing the archive wihout finishing my sentence.
... I'd probably just delete the "else if". Or add
&& getContainer().equals(adapter.getContainer()))
if it makes sense, however I think the whole check for the key is obsolete since its testet at registration so one container can only contain a key once.