You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Wouter Bancken <wo...@aca-it.be> on 2015/08/14 16:53:38 UTC
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
Re: GenericDirective cannot be cast to VersionRangeAttribute
Posted by Wouter Bancken <wo...@aca-it.be>.
Hi John,
Thanks for the quick and clear response! I'll fix the import-package header.
I also logged the Jira: https://issues.apache.org/jira/browse/ARIES-1381
Best regards,
Wouter Bancken
2015-08-14 17:17 GMT+02:00 John W Ross <jw...@us.ibm.com>:
> 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 <wo...@aca-it.be>
>> To: user@aries.apache.org
>> 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
>>
>
Re: GenericDirective cannot be cast to VersionRangeAttribute
Posted by John W Ross <jw...@us.ibm.com>.
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 <wo...@aca-it.be>
> To: user@aries.apache.org
> 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
>