[ 
https://issues.apache.org/jira/browse/SM-5826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Baptiste Onofré resolved SM-5826.
--------------------------------------
    Resolution: Fixed

> opensaml-4.3.2_1 fails to Install due to Invalid Import-Package Syntax
> ----------------------------------------------------------------------
>
>                 Key: SM-5826
>                 URL: https://issues.apache.org/jira/browse/SM-5826
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: bundles
>         Environment: OSGi Container (e.g., Apache Felix)
>            Reporter: Herman Ciechanowiec
>            Assignee: Jean-Baptiste Onofré
>            Priority: Critical
>             Fix For: bundles-2025.05
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Attempting to install the 
> {{org.apache.servicemix.bundles.opensaml-4.3.2_1.jar}} bundle in an OSGi 
> environment results in a {{BundleException}}.
> *Steps to Reproduce:*
>  # Obtain the {{org.apache.servicemix.bundles.opensaml-4.3.2_1.jar}} bundle.
>  # Attempt to install it into an OSGi container (e.g., using the Felix Web 
> Console).
>  # Observe the installation failure and associated error log.
> *Error Log:*
> {code:java}
> 26.04.2025 06:44:10.251 *ERROR* [Background Install 
> /tmp/install10839402681172598319.tmp] org.apache.felix.http Cannot install or 
> update bundle from /tmp/install10839402681172598319.tmp
> org.osgi.framework.BundleException: Could not create bundle object.
>       at org.apache.felix.framework.Felix.installBundle(Felix.java:3339)
>       at 
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:147)
>       at 
> org.apache.felix.webconsole.internal.core.InstallHelper.doRun(InstallHelper.java:54)
>  [org.apache.felix.webconsole:4.9.10]
>       at 
> org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.doRun(BaseUpdateInstallHelper.java:101)
>  [org.apache.felix.webconsole:4.9.10]
>       at 
> org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.run(BaseUpdateInstallHelper.java:166)
>  [org.apache.felix.webconsole:4.9.10]
>       at java.base/java.lang.Thread.run(Thread.java:1583)
> Caused by: java.lang.IllegalArgumentException: invalid range 
> "[3,4);resolution:=optional": invalid format
>       at org.osgi.framework.VersionRange.<init>(VersionRange.java:169)
>       at 
> org.apache.felix.framework.util.manifestparser.ManifestParser.normalizeImportClauses(ManifestParser.java:366)
>       at 
> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:220)
>       at 
> org.apache.felix.framework.BundleRevisionImpl.<init>(BundleRevisionImpl.java:117)
>       at 
> org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1290)
>       at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:114)
>       at org.apache.felix.framework.Felix.installBundle(Felix.java:3287)
>       ... 5 common frames omitted
> {code}
> *Analysis:* 
> The root cause is an invalid syntax in the generated {{Import-Package}} 
> manifest header within the bundle. Specifically, for the {{javax.annotation}} 
> package, the entry is generated as: 
> {{javax.annotation;version="[3,4);resolution:=optional"}}
> The {{resolution:=optional}} directive is incorrectly placed _inside_ the 
> version range string ({{{}"[3,4)"{}}}). According to OSGi specifications, 
> directives should follow the version parameter, separated by a semicolon.
> *Proposed Fix:* 
> Modify the {{pom.xml}} for the {{org.apache.servicemix.bundles.opensaml}} 
> project. Within the {{<properties>}} section, under 
> {{{}<servicemix.osgi.import.pkg>{}}}, change the line for 
> {{javax.annotation}} from:
> {{javax.annotation;version="[3,4);resolution:=optional",}}
> to: 
> {{javax.annotation;version="[3,4)";resolution:=optional,}}
> This correction places the {{resolution:=optional}} directive correctly after 
> the version attribute, resolving the parsing error and allowing the bundle to 
> be installed successfully.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to