felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Offermans (JIRA)" <j...@apache.org>
Subject [jira] Created: (FELIX-2882) It's dangerous to use service instances as keys in a Map (in the http whiteboard bundle).
Date Wed, 16 Mar 2011 23:26:30 GMT
It's dangerous to use service instances as keys in a Map (in the http whiteboard bundle).
-----------------------------------------------------------------------------------------

                 Key: FELIX-2882
                 URL: https://issues.apache.org/jira/browse/FELIX-2882
             Project: Felix
          Issue Type: Bug
          Components: HTTP Service
    Affects Versions: http-2.2.0
            Reporter: Marcel Offermans
            Priority: Minor


In ExtenderManagerImpl.addMapping() the key that is used to store a tuple in a Map is actually
the service instance that you get from the ServiceTracker. This is dangerous because you have
absolutely no idea if that instance correctly implements equals() and hashCode(). It's usually
better to use the ServiceReference as the key (which is guaranteed to correctly implement
those methods). It's probably only a minor issue in practice, but still one you can look for
a long time if it does bite you.

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

Mime
View raw message