Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1381

java.lang.ClassCastException: org.apache.aries.subsystem.core.archive.GenericDirective cannot be cast to org.apache.aries.subsystem.core.archive.VersionRangeAttribute

    XMLWordPrintableJSON

Details

    Description

      Example:
      Import-Package: org.objectweb.asm;version:="5.0.4,5.0.4]",org.objectweb.asm.signature;version:="[5.0.4,5.0.4]",org.objectweb.asm.tree;version:="[5.0.4,5.0.4]"

      This Import-Package header will cause a "GenericDirective cannot be cast to VersionRangeAttribute" error thrown by the ImportPackageHeader class.

      This is caused by the fact that the custom version directive is interpreted as the version attribute by the getVersionRangeAttribute method.

      What should have happened is:
      1. The subsystem install should have succeeded.
      2. The version should have been treated as a custom directive.
      3. The actual package import versions would assume the default of [0.0.0,infinity) since a version attribute was not specified.

      Link to mailinglist discussion: http://mail-archives.apache.org/mod_mbox/aries-user/201508.mbox/%3CCAL5nZgTwUpc05MY4mWNL3D8-2g13u2it6kYd6JG_ueZNWKJOjA%40mail.gmail.com%3E

      Caused by: java.lang.ClassCastException: org.apache.aries.subsystem.core.archive.GenericDirective cannot be cast to org.apache.aries.subsystem.core.archive.VersionRangeAttribute
      at org.apache.aries.subsystem.core.archive.ImportPackageHeader$Clause.getVersionRangeAttribute(ImportPackageHeader.java:155)
      at org.apache.aries.subsystem.core.archive.ImportPackageRequirement.<init>(ImportPackageRequirement.java:42)
      at org.apache.aries.subsystem.core.archive.ImportPackageHeader$Clause.toRequirement(ImportPackageHeader.java:159)
      at org.apache.aries.subsystem.core.archive.ImportPackageHeader.toRequirements(ImportPackageHeader.java:218)
      at org.apache.aries.subsystem.core.internal.BundleResource.computeOsgiWiringPackageRequirements(BundleResource.java:210)
      at org.apache.aries.subsystem.core.internal.BundleResource.computeRequirementsOtherThanService(BundleResource.java:240)
      at org.apache.aries.subsystem.core.internal.BundleResource.computeRequirementsAndCapabilities(BundleResource.java:216)
      at org.apache.aries.subsystem.core.internal.BundleResource.<init>(BundleResource.java:74)
      at org.apache.aries.subsystem.core.internal.RawSubsystemResource.addResource(RawSubsystemResource.java:435)
      at org.apache.aries.subsystem.core.internal.RawSubsystemResource.computeResources(RawSubsystemResource.java:420)
      at org.apache.aries.subsystem.core.internal.RawSubsystemResource.<init>(RawSubsystemResource.java:130)
      at org.apache.aries.subsystem.core.internal.SubsystemResource.<init>(SubsystemResource.java:90)
      at org.apache.aries.subsystem.core.internal.InstallAction.run(InstallAction.java:54)
      ... 55 more

      Attachments

        Issue Links

          Activity

            People

              jwross@us.ibm.com John Ross
              Wouter Bancken Wouter Bancken
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: