Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,22 @@ private static BundleFile improveFileName(File bundlDirectory, BundleFile bf) {

String preferedName = bf.getSymbolicName() + "-" + bf.getVersionAsString() + ".jar";
if (!preferedName.equals(f.getName())) {
// LDEV-6145: do not rename if Felix already has this bundle registered at the current path.
// Renaming without updating Felix leaves the cache pointing at the old (now missing) path,
// causing "Bundle symbolic name and version are not unique" on the next restart.
try {
BundleContext bc = CFMLEngineFactory.getInstance().getBundleContext();
if (bc != null) {
String location = f.getAbsolutePath();
for (Bundle b: bc.getBundles()) {
if (location.equals(b.getLocation())) return bf;
}
}
}
catch (Exception e) {
// engine not yet started; safe to rename
}

try {
File nf = new File(f.getParentFile(), preferedName);
if (f.renameTo(nf)) {
Expand Down
Loading