Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4337

Lowest singleton bundle revision selected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • framework-4.2.1
    • None
    • Framework
    • n/a

    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

      Attachments

        Activity

          People

            Unassigned Unassigned
            mudelta Davy Meers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: