diff --git a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java index d3dd50ba760..4613a77c98d 100644 --- a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java +++ b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java @@ -83,8 +83,6 @@ public class FeatureInstaller implements ConfigurationListener { protected static final String CONFIG_URI = "system:addons"; public static final String PREFIX = "openhab-"; - public static final String PREFIX_PACKAGE = "package-"; - public static final String MINIMAL_PACKAGE = "minimal"; private static final String CFG_REMOTE = "remote"; private static final String PAX_URL_PID = "org.ops4j.pax.url.mvn"; @@ -191,13 +189,6 @@ private synchronized void processConfigQueue() { waitForConfigUpdateEvent(); } - if (installPackage(config)) { - changed = true; - // our package selection has changed, so let's wait for the values to be available in config admin - // which we will receive as another call to modified - continue; - } - if (installAddons(config)) { changed = true; } @@ -278,7 +269,7 @@ private void waitForConfigUpdateEvent() { private void changeAddonConfig(String type, String id, BiFunction, String, Boolean> method) throws IOException { Configuration cfg = configurationAdmin.getConfiguration(OpenHAB.ADDONS_SERVICE_PID, null); - Dictionary props = cfg.getProperties(); + Dictionary props = Objects.requireNonNullElse(cfg.getProperties(), new Hashtable<>()); Object typeProp = props.get(type); String[] addonIds = typeProp != null ? typeProp.toString().split(",") : new String[0]; Set normalizedIds = new HashSet<>(); // sets don't allow duplicates @@ -512,27 +503,6 @@ private void uninstallFeature(String name) { } } - private boolean installPackage(final Map config) { - boolean configChanged = false; - Object packageName = config.get(OpenHAB.CFG_PACKAGE); - if (packageName instanceof String currentPackage) { - String fullName = PREFIX + PREFIX_PACKAGE + currentPackage.strip(); - if (!MINIMAL_PACKAGE.equals(currentPackage)) { - configChanged = installFeature(fullName); - } - - // uninstall all other packages - try { - Stream.of(featuresService.listFeatures()).map(Feature::getName) - .filter(feature -> feature.startsWith(PREFIX + PREFIX_PACKAGE) && !feature.equals(fullName)) - .forEach(this::uninstallFeature); - } catch (Exception e) { - logger.error("Failed retrieving features: {}", e.getMessage(), debugException(e)); - } - } - return configChanged; - } - private void postInstalledEvent(String featureName) { String extensionId = featureName.substring(PREFIX.length()); Event event = AddonEventFactory.createAddonInstalledEvent(extensionId);