Skip to content

[4.4.x] Handle invalid OSGi versions in FeatureReq and Subsystem - #3140

Open
jbonofre wants to merge 1 commit into
apache:karaf-4.4.xfrom
jbonofre:backport-3139-karaf-4.4.x
Open

jbonofre wants to merge 1 commit into
apache:karaf-4.4.xfrom
jbonofre:backport-3139-karaf-4.4.x

Conversation

@jbonofre

Copy link
Copy Markdown
Member

Backport of #3139 (commit b75cae0) to karaf-4.4.x. Cherry-picked cleanly.

Context

#2993 and #3138 backported #2978, but not its follow-up #3139. On karaf-4.4.x, FeatureReq and Subsystem are identical to main before #3139, so a feature with an unparseable OSGi version (e.g. 1.0.0.beta+1) still throws IllegalArgumentException:

  • getFeature("bad", "1.0.0.beta+1"), listRequiredFeatures() and isRequired(bad) fail in FeatureReq.exactVersion.
  • When an invalid f/1.0.0.beta+1 sits next to a valid f/1.0.0, getFeature("f"), getFeature("f", "1.0.0") and installing f fail in FeatureReq.getLatestFeature and Subsystem.doBuild.

Changes

Same as #3139:

  • FeatureReq keeps the raw version when it can't be parsed as an OSGi version range, and getLatestFeature() skips unparseable versions.
  • Subsystem.doBuild() skips a same-name feature with an unparseable version and logs a warning.
  • Tests: FeaturesServiceImplTest#testFeatureWithInvalidVersionDoesNotBreakOtherFeatures is extended. FeaturesServiceImplTest#testFeatureWithSameNameAndInvalidVersionDoesNotBreakInstall (with invalidversion/same-name.xml) and SubsystemTest#testIgnoreSameNameFeatureWithInvalidVersion are added.

Testing

  • JDK 11, mvn -pl features/core test: 133 tests, 0 failures, 0 errors, 2 pre-existing skipped (FeaturesServiceImplTest: 15, SubsystemTest: 16).
  • With FeatureReq.java and Subsystem.java reverted to karaf-4.4.x, the three new or extended tests fail with IllegalArgumentException: invalid version "1.0.0.beta+1".

Backport of apache#3139 to karaf-4.4.x.

(cherry picked from commit b75cae0)
@github-actions

Copy link
Copy Markdown

Test Results

  694 files  ±0    694 suites  ±0   56m 11s ⏱️ - 3m 26s
1 084 tests +2  1 041 ✅ +2   43 💤 ±0  0 ❌ ±0 
2 977 runs  +6  2 856 ✅ +6  121 💤 ±0  0 ❌ ±0 

Results for commit 46b06f6. ± Comparison against base commit a521c07.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant