You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/03/06 14:34:00 UTC

[jira] [Commented] (KARAF-6183) FeaturesProcessorImpl improvement for bundle override

    [ https://issues.apache.org/jira/browse/KARAF-6183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16785689#comment-16785689 ] 

ASF GitHub Bot commented on KARAF-6183:
---------------------------------------

Smasherr commented on pull request #772: [KARAF-6183] Fix override for classified artifacts.
URL: https://github.com/apache/karaf/pull/772
 
 
   We take now the pattern from override.properties, which
   matches best (i.e. has the biggest length), not the last one
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> FeaturesProcessorImpl improvement for bundle override
> -----------------------------------------------------
>
>                 Key: KARAF-6183
>                 URL: https://issues.apache.org/jira/browse/KARAF-6183
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf
>    Affects Versions: 4.2.3
>            Reporter: Daniel Estermann
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: 4.3.0, 4.2.4
>
>
> Say we have the following override.properties:
> {{mvn:com.seeburger.portal/portal-backend-sdk/2.69.0-SNAPSHOT;range="[0,99999)" mvn:com.seeburger.portal/portal-backend-sdk/2.69.0-SNAPSHOT/jar/karaf-migration;range="[0,99999)"}}
> which are supposed to do the following replacements:
> {{portal-backend-sdk/2.68.3}} → {{portal-backend-sdk/2.69.0-SNAPSHOT}}
> and
> {{portal-backend-sdk/2.68.3/jar/karaf-migration}} → {{portal-backend-sdk/2.69.0-SNAPSHOT/jar/karaf-migration}}
> But the method [FeaturesProcessorImpl.staticOverrideBundle(Bundle)|https://github.com/apache/karaf/blob/master/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesProcessorImpl.java#L225] replaces {{portal-backend-sdk/2.68.3/jar/karaf-migration}} with {{portal-backend-sdk/2.69.0-SNAPSHOT}}, i.e. a classified artifact gets replaced with an artifact without classifier. This happens because the implementation of [LocationPattern|https://github.com/apache/karaf/blob/master/features/core/src/main/java/org/apache/karaf/features/LocationPattern.java#L151] allows matching of classified URI by a non-classified pattern. The LocationPatternTest indicates that this is an intentional behavior: see line [112|https://github.com/apache/karaf/blob/master/features/core/src/test/java/org/apache/karaf/features/internal/service/LocationPatternTest.java#L112], [115|https://github.com/apache/karaf/blob/master/features/core/src/test/java/org/apache/karaf/features/internal/service/LocationPatternTest.java#L115], [116|https://github.com/apache/karaf/blob/master/features/core/src/test/java/org/apache/karaf/features/internal/service/LocationPatternTest.java#L116].
> I can understand why {{LocationPattern}} is implemented like that. But then my guess is that {{FeaturesProcessorImpl}} is incorrect. There is a comment which shows the anticipation of such misbehavior: {{TOCHECK: last rule wins - no break!!!}} Last rule indeed doesn't work in this case. I think what is crucial here, is that we shouldn't rely on the order of overrides, but rather on their quality. I.e. not the first/last match is appropriate, but the best one. I propose to collect candidates to match and then determine the best one using simply the length as criterion.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)