You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Grzegorz Grzybek (JIRA)" <ji...@apache.org> on 2018/11/07 12:08:00 UTC
[jira] [Commented] (ARIES-1254) ManifestHeaderProcessor.parseFilter
throws IllegalArgumentException on legal filter containing '='
[ https://issues.apache.org/jira/browse/ARIES-1254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678126#comment-16678126 ]
Grzegorz Grzybek commented on ARIES-1254:
-----------------------------------------
Indeed. I checked felix utils and felix framework and I don't see it felix having problems with {{=}} with version attribute.
The specification itself contains such examples:
{quote}
h4. 8.2 osgi.ee Namespace
\[…]
{noformat}
Require-Capability: «
osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.6))"
{noformat}
{quote}
> ManifestHeaderProcessor.parseFilter throws IllegalArgumentException on legal filter containing '='
> --------------------------------------------------------------------------------------------------
>
> Key: ARIES-1254
> URL: https://issues.apache.org/jira/browse/ARIES-1254
> Project: Aries
> Issue Type: Bug
> Components: Util
> Environment: All envs
> Reporter: Iain Lewis
> Priority: Major
>
> I have an OSGI bundle where the manifest contains a capability requirement of:
> Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.6))"
> Trying to parse this with the parseFilter() method throws an IlegalArgumentException. The code snippet below is sufficient to reproduce the problem.
> {noformat}
> String attribute = "osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version=1.6))\"";
> List<GenericMetadata> requirementMetadata = ManifestHeaderProcessor.parseRequirementString(attribute);
> for (GenericMetadata metaData : requirementMetadata) {
> if (metaData.getNamespace().equals("osgi.ee")) {
> Map<String, String> dirs = metaData.getDirectives();
> for (String key : dirs.keySet()) {
> if (key.equals("filter")) {
> Map<String, String> filter = ManifestHeaderProcessor.parseFilter(dirs.get(key)); // Throws IllegalArgumentException
> }
> }
> }
> }
> {noformat}
> There is a fairly trivial fix for this. Looking at the version of the source from here:
> https://svn.apache.org/repos/asf/aries/trunk/util/util-r42/src/main/java/org/apache/aries/util/manifest/ManifestHeaderProcessor.java
> On line 713:
> {noformat}
> else if (LESS_EQ_OP.equals(op))
> upperVersion = value;
> else
> throw new IllegalArgumentException();
> }
> {noformat}
> Should become this:
> {noformat}
> } else if (LESS_EQ_OP.equals(op)) {
> upperVersion = value;
> } else if (EQ_OP.equals(op)) {
> lowerVersion = value;
> upperVersion = value;
> } else {
> throw new IllegalArgumentException();
> }
> {noformat}
> And a new constant of EQ_OP needs to be added
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)