felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davy Meers (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FELIX-4337) Lowest singleton bundle revision selected
Date Fri, 29 Nov 2013 16:52:35 GMT

     [ https://issues.apache.org/jira/browse/FELIX-4337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Davy Meers updated FELIX-4337:
------------------------------

    Description: 
The comment of the method "selectSingleton" of the "StatefulResolver"[1] explains that the
highest bundle revision is selected but it seems that the lowest singleton bundle revision
is selected.

Given the following bundles:

    // Bundle-SymbolicName: exporter; singleton:=true
    // Bundle-Version: 1.0.0
    // Export-Package: a

    // Bundle-SymbolicName: exporter; singleton:=true
    // Bundle-Version: 2.0.0
    // Export-Package: b

    // Bundle-SymbolicName: importer
    // Bundle-Version: 1.0.0
    // Import-Package: a

    // Bundle-SymbolicName: importer
    // Bundle-Version: 2.0.0
    // Import-Package: b

When bundle importer-2.0.0 is started, a bundle exception is thrown (missing requirement),
although the required package is provided by the highest singleton bundle revision (exporter-2.0.0).

When bundle importer-1.0.0 is started,it resolves, although the required package is provided
by the lowest singleton bundle revision (exporter-1.0.0).

This is the output from the console that shows the above:

g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    2|Active     |    1|Apache Felix Gogo Command (0.12.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    5|Installed  |    1|importer (1.0.0)
    6|Installed  |    1|importer (2.0.0)
    7|Installed  |    1|exporter (1.0.0)
    8|Installed  |    1|exporter (2.0.0)
g! start 6
org.osgi.framework.BundleException: Unresolved constraint in bundle importer [6]: Unable to
resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=b)
g! start 5
g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    2|Active     |    1|Apache Felix Gogo Command (0.12.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    5|Active     |    1|importer (1.0.0)
    6|Installed  |    1|importer (2.0.0)
    7|Resolved   |    1|exporter (1.0.0)
    8|Installed  |    1|exporter (2.0.0)

I am not sure about the desired behavior, but there is a discrepancy between the code and
the comment.

If the comment describes the wanted behavior it can be achieved by replacing "(selected.getVersion().compareTo(singleton.getVersion())
> 0"[2] with "(singleton.getVersion().compareTo(selected.getVersion()) > 0", or with
"(selected.getVersion().compareTo(singleton.getVersion()) < 0" 

[1] http://svn.apache.org/viewvc/felix/releases/org.apache.felix.framework-4.2.1/src/main/java/org/apache/felix/framework/StatefulResolver.java?view=markup#l1361
[2] http://svn.apache.org/viewvc/felix/releases/org.apache.felix.framework-4.2.1/src/main/java/org/apache/felix/framework/StatefulResolver.java?view=markup#l1385

  was:
The comment of the method {{private void selectSingleton(ResolverHookRecord record, List<BundleRevision>
singletons)}} of the {{StatefulResolver}}[1] explains that the highest bundle revision is
selected but it seems that the lowest singleton bundle revision is selected.

Given the following bundles:

// Bundle-SymbolicName: exporter; singleton:=true
// Bundle-Version: 1.0.0
// Export-Package: a

// Bundle-SymbolicName: exporter; singleton:=true
// Bundle-Version: 2.0.0
// Export-Package: b

// Bundle-SymbolicName: importer
// Bundle-Version: 1.0.0
// Import-Package: a

// Bundle-SymbolicName: importer
// Bundle-Version: 2.0.0
// Import-Package: b

When bundle importer-2.0.0 is started, a bundle exception is thrown (missing requirement),
although the required package is provided by the highest singleton bundle revision (exporter-2.0.0).

When bundle importer-1.0.0 is started,it resolves, although the required package is provided
by the lowest singleton bundle revision (exporter-1.0.0).

This is the output from the console that shows the above:

g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    2|Active     |    1|Apache Felix Gogo Command (0.12.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    5|Installed  |    1|importer (1.0.0)
    6|Installed  |    1|importer (2.0.0)
    7|Installed  |    1|exporter (1.0.0)
    8|Installed  |    1|exporter (2.0.0)
g! start 6
org.osgi.framework.BundleException: Unresolved constraint in bundle importer [6]: Unable to
resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=b)
g! start 5
g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    2|Active     |    1|Apache Felix Gogo Command (0.12.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    5|Active     |    1|importer (1.0.0)
    6|Installed  |    1|importer (2.0.0)
    7|Resolved   |    1|exporter (1.0.0)
    8|Installed  |    1|exporter (2.0.0)

I am not sure about the desired behavior, but there is a discrepancy between the code and
the comment.

If the comment describes the wanted behavior it can be achieved by replacing {{(selected.getVersion().compareTo(singleton.getVersion())
> 0}}[2] with {{(singleton.getVersion().compareTo(selected.getVersion()) > 0}}, or with
{{(selected.getVersion().compareTo(singleton.getVersion()) < 0}} 

[1] http://svn.apache.org/viewvc/felix/releases/org.apache.felix.framework-4.2.1/src/main/java/org/apache/felix/framework/StatefulResolver.java?view=markup#l1361
[2] http://svn.apache.org/viewvc/felix/releases/org.apache.felix.framework-4.2.1/src/main/java/org/apache/felix/framework/StatefulResolver.java?view=markup#l1385


> Lowest singleton bundle revision selected
> -----------------------------------------
>
>                 Key: FELIX-4337
>                 URL: https://issues.apache.org/jira/browse/FELIX-4337
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-4.2.1
>         Environment: n/a
>            Reporter: Davy Meers
>            Priority: Minor
>              Labels: framework, resolver, singleton
>
> The comment of the method "selectSingleton" of the "StatefulResolver"[1] explains that
the highest bundle revision is selected but it seems that the lowest singleton bundle revision
is selected.
> Given the following bundles:
>     // Bundle-SymbolicName: exporter; singleton:=true
>     // Bundle-Version: 1.0.0
>     // Export-Package: a
>     // Bundle-SymbolicName: exporter; singleton:=true
>     // Bundle-Version: 2.0.0
>     // Export-Package: b
>     // Bundle-SymbolicName: importer
>     // Bundle-Version: 1.0.0
>     // Import-Package: a
>     // Bundle-SymbolicName: importer
>     // Bundle-Version: 2.0.0
>     // Import-Package: b
> When bundle importer-2.0.0 is started, a bundle exception is thrown (missing requirement),
although the required package is provided by the highest singleton bundle revision (exporter-2.0.0).
> When bundle importer-1.0.0 is started,it resolves, although the required package is provided
by the lowest singleton bundle revision (exporter-1.0.0).
> This is the output from the console that shows the above:
> g! lb
> START LEVEL 1
>    ID|State      |Level|Name
>     0|Active     |    0|System Bundle (4.2.1)
>     1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
>     2|Active     |    1|Apache Felix Gogo Command (0.12.0)
>     3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
>     4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
>     5|Installed  |    1|importer (1.0.0)
>     6|Installed  |    1|importer (2.0.0)
>     7|Installed  |    1|exporter (1.0.0)
>     8|Installed  |    1|exporter (2.0.0)
> g! start 6
> org.osgi.framework.BundleException: Unresolved constraint in bundle importer [6]: Unable
to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=b)
> g! start 5
> g! lb
> START LEVEL 1
>    ID|State      |Level|Name
>     0|Active     |    0|System Bundle (4.2.1)
>     1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
>     2|Active     |    1|Apache Felix Gogo Command (0.12.0)
>     3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
>     4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
>     5|Active     |    1|importer (1.0.0)
>     6|Installed  |    1|importer (2.0.0)
>     7|Resolved   |    1|exporter (1.0.0)
>     8|Installed  |    1|exporter (2.0.0)
> I am not sure about the desired behavior, but there is a discrepancy between the code
and the comment.
> If the comment describes the wanted behavior it can be achieved by replacing "(selected.getVersion().compareTo(singleton.getVersion())
> 0"[2] with "(singleton.getVersion().compareTo(selected.getVersion()) > 0", or with
"(selected.getVersion().compareTo(singleton.getVersion()) < 0" 
> [1] http://svn.apache.org/viewvc/felix/releases/org.apache.felix.framework-4.2.1/src/main/java/org/apache/felix/framework/StatefulResolver.java?view=markup#l1361
> [2] http://svn.apache.org/viewvc/felix/releases/org.apache.felix.framework-4.2.1/src/main/java/org/apache/felix/framework/StatefulResolver.java?view=markup#l1385



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message