Make OSGi boot more robust against badly formatted bundles.
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 16 Sep 2019 09:31:24 +0000 (11:31 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 16 Sep 2019 09:31:24 +0000 (11:31 +0200)
org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/FsA2Source.java

index 1072a11498fdf03ab10be82df2fcf3d5086a0f0d..6fc25c1127f98d8adf93d390b6e072d99ae15b8f 100644 (file)
@@ -54,9 +54,12 @@ public class FsA2Source extends ProvisioningSource {
                                                version = new Version(versionStr);
                                        } catch (Exception e) {
                                                versionStr = readVersionFromModule(modulePath);
-                                               version = new Version(versionStr);
-                                               // OsgiBootUtils.debug("Ignore " + modulePath + " (" + e.getMessage() + ")");
-                                               // continue modules;
+                                               if (versionStr != null) {
+                                                       version = new Version(versionStr);
+                                               } else {
+                                                       OsgiBootUtils.debug("Ignore " + modulePath + " (" + e.getMessage() + ")");
+                                                       continue modules;
+                                               }
                                        }
                                        A2Component component = contribution.getOrAddComponent(componentName);
                                        A2Module module = component.getOrAddModule(version, modulePath);