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

Version range in import declaration creates a filter using invalid operators (<,>)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • maven-bundle-plugin-2.3.4
    • Maven Bundle Plugin
    • None
    • Maven Bundle Plugin 1.4.3
      Apache Felix Bundle Repository (1.2.0)
      Apache Felix 1.2.1/Equinox 3.4.0

    Description

      If a version range is given for an import-declaration (e.g. bundle http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.javax.jms&version=1.1.0) the maven bundle plugin creates version filters for the OBR repository which might contain the operators < and >, e.g.:

      <require extend="false" filter="(&(package=javax.transaction.xa)(version>=1.0.1)(version<2.0.0))" multiple="false" name="package" optional="true">Import package javax.transaction.xa ;version=[1.0.1,2.0.0)</require>

      These operators are currently not supported by Felix and Equinox, the OSGi specification (at least 4.0.1) only states "<=" and ">=" as valid ones.
      The resulting problem are exceptions while reading the repository descriptor:

      Caused by: org.osgi.framework.InvalidSyntaxException: expected ~=|>=|<=
      at org.apache.felix.framework.FilterImpl.<init>(FilterImpl.java:81)
      at org.apache.felix.framework.BundleContextImpl.createFilter(BundleContextImpl.java:104)
      at org.apache.felix.bundlerepository.RequirementImpl.setFilter(RequirementImpl.java:57)

      A simple patch for the class org.osgi.impl.bundle.obr.resource.BundleInfo.java is attached to this issue. The solution is to replace (version<2.0.0) by (!(version>=2.0.0))

      Attachments

        1. Parser.java
          42 kB
          Atle Prange
        2. BundleInfo.java.diff
          1 kB
          Dirk Mahler

        Activity

          People

            mcculls Stuart McCulloch
            dirk.mahler Dirk Mahler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: