To be clear, the Import-Package header is incorrect. The version is an 
attribute, not a directive. It should be

> 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]"

Having said that, custom attributes and directives are allowed. In your 
case, what I think 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.

So yes, I think this is a bug worthy of a JIRA, although you're probably 
happy to know about this right away rather than wondering why you got 
wired to org.objectweb.asm 1.0.



> From: Wouter Bancken <[email protected]>
> To: [email protected]
> Date: 08/14/2015 09:53 AM
> Subject: GenericDirective cannot be cast to VersionRangeAttribute
> 
> Dear,
> 
> I'm getting the following exception when trying to install a subsystem:
> GenericDirective cannot be cast to VersionRangeAttribute
> 
> This exception is thrown when trying to parse the following
> Import-Package header:
> 
> 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]"
> 
> The exception is thrown at line 155 of the ImportPackageHeader class:
> return 
(VersionRangeAttribute)myParameters.get(Constants.VERSION_ATTRIBUTE);
> 
> The reason for the wrong class is that the ParameterFactory class
> cannot handle the ':=' in the specification of the version. It only
> works for a single '=' without a colon:
> if (symbol.equals("=")) {
>    return AttributeFactory.createAttribute(name, value);
> }
> 
> Should I log a bug for this behaviour?
> 
> Best regards,
> Wouter Bancken
> 

Reply via email to