Use locator path as OSGi installation string
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 16 Oct 2023 07:33:50 +0000 (09:33 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 16 Oct 2023 07:33:50 +0000 (09:33 +0200)
org.argeo.init/src/org/argeo/init/a2/AbstractProvisioningSource.java

index 617e7887806f451a9eb89cd874610ccf8bab0344..800635c9e93748214b95c9b286bce88b6be41352 100644 (file)
@@ -47,17 +47,19 @@ public abstract class AbstractProvisioningSource implements ProvisioningSource {
                                Bundle bundle = bc.installBundle(referenceUrl);
                                return bundle;
                        } else {
-
-                               Path tempJar = null;
-                               if (locator instanceof Path && Files.isDirectory((Path) locator))
-                                       tempJar = toTempJar((Path) locator);
+                               Path locatorPath = (Path) locator;
+                               Path pathToUse;
+                               if (locator instanceof Path && Files.isDirectory(locatorPath))
+                                       pathToUse = toTempJar(locatorPath);
+                               else
+                                       pathToUse = locatorPath;
                                Bundle bundle;
-                               try (InputStream in = newInputStream(tempJar != null ? tempJar : locator)) {
-                                       bundle = bc.installBundle(module.getBranch().getCoordinates(), in);
+                               try (InputStream in = newInputStream(pathToUse)) {
+                                       bundle = bc.installBundle(locatorPath.toAbsolutePath().toString(), in);
                                }
 
-                               if (tempJar != null)
-                                       Files.deleteIfExists(tempJar);
+                               if (pathToUse != null)
+                                       Files.deleteIfExists(pathToUse);
                                return bundle;
                        }
                } catch (BundleException | IOException e) {