You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/05/25 15:51:13 UTC

[jira] [Commented] (ARIES-1554) FelixResourceAdapter returns true for resources of other types

    [ https://issues.apache.org/jira/browse/ARIES-1554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15300262#comment-15300262 ] 

ASF subversion and git services commented on ARIES-1554:
--------------------------------------------------------

Commit 1745511 from tjwatson@apache.org in branch 'aries/trunk'
[ https://svn.apache.org/r1745511 ]

[ARIES-1554] FelixResourceAdapter returns true for resources of other types

> FelixResourceAdapter returns true for resources of other types
> --------------------------------------------------------------
>
>                 Key: ARIES-1554
>                 URL: https://issues.apache.org/jira/browse/ARIES-1554
>             Project: Aries
>          Issue Type: Bug
>          Components: Subsystem
>         Environment: All
>            Reporter: Thomas Watson
>            Assignee: Thomas Watson
>
> The Resource implementation org.apache.aries.subsystem.util.felix.FelixResourceAdapter does an equality check based on the osgi.identity name, version, and type.  This typically is not an issue but the contract for Resource.equals states the following:
> <javadoc>
> This Resource is equal to another Resource if both have the same content and come from the same location. Location may be defined as the bundle location if the resource is an installed bundle or the repository location if the resource is in a repository.
> </javadoc>
> The assumption is that if the osgi.identity name, version and type are equal then the resources have the "same content".  But the implementation does not take into account the location.  This causes issues if resources are used as keys in a Map and the Map will contain resources of different implementation types.  This is done by the felix resolver implementation.  In some scenarios the subsystems will return to the resolver resources from the OBR repository and from the system repository (installed bundles) that have the same name, version, type.  From the resolver's perspective these two resources must be treated as distinctly different resources because they come from completely different locations.  And the framework's Resource implementation of equals does return false if checked against a FelixResourceAdapter, but the FelixResourceAdapter equals method will return true if check against the framework's Resource implementation.  This inconsistency in the equals behavior reeks havoc for Map implementations.  Usually the issue is very intermittent because of they way hash slots are determined based on hashcodes, but in rare cases these two resources will be slotted the same and collide with eachother depending on the Map implementation.
> At a minimum the FelixResourceAdapter should check that the other object is an instance of FelixResourceAdapter to be able to return true.  This makes the simple assumption that if the Resource is not of type FelixResourceAdapter then there is no way the resource is at the same location.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)