Fix suggestion finder installation (#4209)

* fix finder installation
* no install/uninstall if no config object

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This commit is contained in:
Mark Herwege 2024-05-04 18:18:50 +02:00 committed by GitHub
parent 4dfbfb4995
commit 49cfb20fb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,7 +80,7 @@ public class AddonSuggestionService implements AutoCloseable {
this.configurationAdmin = configurationAdmin;
this.localeProvider = localeProvider;
SUGGESTION_FINDERS.forEach(f -> baseFinderConfig.put(f, true));
SUGGESTION_FINDERS.forEach(f -> baseFinderConfig.put(f, false));
modified(config);
// Changes to the configuration are expected to call the {@link modified} method. This works well when running
@ -115,13 +115,13 @@ public class AddonSuggestionService implements AutoCloseable {
String cfgParam = SUGGESTION_FINDER_CONFIGS.get(finder);
if (cfgParam != null) {
boolean enabled = (config != null)
? ConfigParser.valueAsOrElse(config.get(cfgParam), Boolean.class, cfg)
? ConfigParser.valueAsOrElse(config.get(cfgParam), Boolean.class, true)
: cfg;
if (cfg != enabled) {
baseFinderConfig.put(finder, enabled);
String type = SUGGESTION_FINDER_TYPES.get(finder);
AddonFinderService finderService = addonFinderService;
if (type != null && finderService != null) {
baseFinderConfig.put(finder, enabled);
if (enabled) {
finderService.install(type);
} else {