Catch ISE if config admin is no longer available (#3949)

pull/3953/head
Kai Kreuzer 2023-12-21 21:36:11 +01:00 committed by GitHub
parent 924e7b2d6d
commit 4b310aff30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -12,9 +12,7 @@
*/ */
package org.openhab.core.config.discovery.addon; package org.openhab.core.config.discovery.addon;
import static org.openhab.core.config.discovery.addon.AddonFinderConstants.SUGGESTION_FINDERS; import static org.openhab.core.config.discovery.addon.AddonFinderConstants.*;
import static org.openhab.core.config.discovery.addon.AddonFinderConstants.SUGGESTION_FINDER_CONFIGS;
import static org.openhab.core.config.discovery.addon.AddonFinderConstants.SUGGESTION_FINDER_FEATURES;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,6 +48,8 @@ import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy; import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.ReferencePolicyOption; import org.osgi.service.component.annotations.ReferencePolicyOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* This is a {@link AddonSuggestionService} which discovers suggested add-ons for the user to install. * This is a {@link AddonSuggestionService} which discovers suggested add-ons for the user to install.
@ -64,6 +64,8 @@ public class AddonSuggestionService implements AutoCloseable {
public static final String SERVICE_NAME = "addon-suggestion-service"; public static final String SERVICE_NAME = "addon-suggestion-service";
public static final String CONFIG_PID = "org.openhab.addons"; public static final String CONFIG_PID = "org.openhab.addons";
private final Logger logger = LoggerFactory.getLogger(AddonSuggestionService.class);
private final Set<AddonInfoProvider> addonInfoProviders = ConcurrentHashMap.newKeySet(); private final Set<AddonInfoProvider> addonInfoProviders = ConcurrentHashMap.newKeySet();
private final List<AddonFinder> addonFinders = Collections.synchronizedList(new ArrayList<>()); private final List<AddonFinder> addonFinders = Collections.synchronizedList(new ArrayList<>());
private final ConfigurationAdmin configurationAdmin; private final ConfigurationAdmin configurationAdmin;
@ -148,7 +150,8 @@ public class AddonSuggestionService implements AutoCloseable {
if (!cfgMap.equals(config)) { if (!cfgMap.equals(config)) {
modified(cfgMap); modified(cfgMap);
} }
} catch (IOException e) { } catch (IOException | IllegalStateException e) {
logger.debug("Exception occurred while trying to sync the configuration: {}", e.getMessage());
} }
} }