Repository navigation
LDEV-6627 load Require-Bundle bundles first, keep the failed download as cause - #15
Merged
Merged
Conversation
… as cause of the error
GianTschingt
approved these changes
Nov 20, 2026
GianTschingt
left a comment
Contributor
There was a problem hiding this comment.
Looks good, both fixes do what #3849 needs. I checked org.lucee:janino:3.1.9: it has Require-Bundle: org.lucee.janinocc;bundle-version=3.1.9, so loading the required bundle first resolves org.codehaus.commons.compiler. The URL lookup error is now the cause, which is what LDEV6313 checks.
A few points, the first one I'd fix here or right after:
- Require-Bundle is only read when a jar gets installed (
load()at L448/L478). A bundle that is already installed returns early, and withstorage.clean=noneit stays installed across restarts. So an install whereorg.lucee.janinois already in INSTALLED state (e.g. from 1.0.0.1-BETA) still fails after the upgrade, and a temporary download failure of janinocc stays stuck until restart. The package branch ofloadMissing(L646) andinstall(File, boolean)(L774) skip it too. Core reads the requirements from the installed bundle when it starts it (getRequiredBundles(bundle)viaBundleRevision). Loading theosgi.wiring.bundlerequirements of the bundle whenstartIfNecessaryfails inloadAndStartwould cover all of these. loadRequiredBundlesdrops the failures (L416). The resolver then names the missing package first, so the user gets "no bundle known that exports the package [org.codehaus.commons.compiler]" instead of the real download error. Could they be added toproblems?- Only the URL lookup is wrapped. An IOException while streaming the download (L497-506) still comes through without the bundle name or a cause.
- Minor: required bundles are installed but not started (core started them), the wrapped message repeats the bundle name, and
failedDownloadIsTheCauseOfTheErrorneeds network access.
#3849 still bundles 1.0.0.1-BETA, so after this is merged we need a new BETA published and #3849 bumped to it to get it green.
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.
Two fixes found by the Lucee tests with the OSGi extension (lucee/Lucee#3849).
Require-Bundle is loaded first
A bundle like `org.lucee.janino` has `Import-Package: org.codehaus.commons.compiler` and `Require-Bundle: org.lucee.janinocc`. The resolver reports the missing package first, no bundle is known for that package, and the load failed (`no bundle known that exports the package [org.codehaus.commons.compiler]`, Lucee `test/general/Janino.cfc`). Now the non optional `Require-Bundle` entries of a jar (with their `bundle-version` range) are loaded before the jar is installed, in both `load()` overloads. A required bundle that cannot be loaded is ignored there and reported by the resolver when the bundle is started, as before. `system.bundle` is skipped, a thread local guards against cycles.
The failed download is the cause of the error
`download()` only wrapped `BundleException` and `RuntimeException` of the URL lookup, the `IOException` ("no URL found for bundle ...") went out without cause. It is wrapped as well now (Lucee `test/tickets/LDEV6313.cfc` expects `e.cause`).
New `RequireBundleTest`: parsing of `Require-Bundle`, a bundle that imports a package of its required bundle (fails with exactly the Janino error without the change), and the cause of a failed download.