Repository navigation
Handle invalid OSGi versions in FeatureReq and Subsystem - #3139
Merged
jbonofre merged 1 commit intoNov 20, 2026
Merged
Conversation
Follow-up to apache#2978 for the two remaining places where unparseable OSGi feature versions caused IllegalArgumentException: - FeatureReq: fall back to raw version matching/formatting when exactVersion cannot parse a version as an OSGi VersionRange (e.g. getFeature("bad", "1.0.0.beta+1") and listRequiredFeatures()/isRequired()), and skip unparseable versions in getLatestFeature() instead of failing on same-name valid features. - Subsystem: skip same-name features whose version cannot be parsed by VersionTable.getVersion() during subsystem building, with a warning log, so an invalid version next to a valid one does not break installing the valid feature. - Add tests in FeaturesServiceImplTest and SubsystemTest covering exact lookup, listRequiredFeatures/isRequired, and installing a valid feature alongside a same-name invalid-version feature.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2978 addressing the two remaining places noted in the review comments where a feature with an unparseable OSGi version (e.g.
1.0.0.beta+1) still causedIllegalArgumentException:Problem
FeatureReq:getFeature("bad", "1.0.0.beta+1")orlistRequiredFeatures()/isRequired(bad)threwIllegalArgumentExceptioninFeatureReq.exactVersion.f/1.0.0.beta+1next tof/1.0.0),FeatureReq.getLatestFeatureiterated all versions offand threwIllegalArgumentExceptioninVersionTable.getVersion, breakinggetFeature("f")andgetFeature("f", "1.0.0").Subsystem:Subsystem.doBuildparsedVersionTable.getVersion(feature.getVersion())for every same-name feature inallFeatures.get(name), so an invalidf/1.0.0.beta+1next tof/1.0.0broke installingf.Changes
FeatureReq:rawVersionwhenexactVersioncannot parse a version as an OSGiVersionRange, allowinggetFeature("bad", "1.0.0.beta+1"),isRequired(), andlistRequiredFeatures()to work without throwing.getLatestFeature()when evaluating OSGi version ranges so same-name valid features remain selectable.Subsystem:IllegalArgumentExceptionfromVersionTable.getVersion(feature.getVersion())indoBuild()and skip the unparseable feature with a warning log, since it cannot be represented as aSubsystemorFeatureResourceanyway.FeaturesServiceImplTest#testFeatureWithInvalidVersionDoesNotBreakOtherFeaturesto verifylistRequiredFeatures(),isRequired(), andgetFeature("bad", "1.0.0.beta+1").FeaturesServiceImplTest#testFeatureWithSameNameAndInvalidVersionDoesNotBreakInstall(withinvalidversion/same-name.xml).SubsystemTest#testIgnoreSameNameFeatureWithInvalidVersion.Testing
JAVA_HOME=$(/usr/libexec/java_home -v 21) mvn -pl features/core -am test:features/corepassed (157 tests, 0 failures, 0 errors, 2 pre-existing skipped;FeaturesServiceImplTest: 19 tests, 0 failures, 0 errors).