Make OSGi Boot more robust
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 14 Apr 2017 12:13:17 +0000 (14:13 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 14 Apr 2017 12:13:17 +0000 (14:13 +0200)
org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBoot.java

index f44642d526fd8c8a2e429ffa1144aac042c52a1f..34457e669f1bf6387fc0cb5dbf8c4f4bf7404fe3 100644 (file)
@@ -181,11 +181,16 @@ public class OsgiBoot implements OsgiBootConstants {
                                else if (OsgiBootUtils.debug)
                                        OsgiBootUtils.debug(
                                                        "Installed " + bundle.getSymbolicName() + "-" + bundle.getVersion() + " from " + url);
+                               assert bundle.getSymbolicName() != null;
                                // uninstall previous versions
                                bundles: for (Bundle b : bundleContext.getBundles()) {
+                                       if (b.getSymbolicName() == null)
+                                               continue bundles;
                                        if (bundle.getSymbolicName().equals(b.getSymbolicName())) {
                                                Version bundleV = bundle.getVersion();
                                                Version bV = b.getVersion();
+                                               if (bV == null)
+                                                       continue bundles;
                                                if (bundleV.getMajor() == bV.getMajor() && bundleV.getMinor() == bV.getMinor()) {
                                                        if (bundleV.getMicro() > bV.getMicro()) {
                                                                // uninstall older bundles