Skip to content

Commit

Permalink
Fix suggestion finder installation (#4209)
Browse files Browse the repository at this point in the history
* fix finder installation
* no install/uninstall if no config object

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
  • Loading branch information
mherwege authored May 4, 2024
1 parent 4dfbfb4 commit 49cfb20
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public AddonSuggestionService(final @Reference ConfigurationAdmin configurationA
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
Expand Down Expand Up @@ -115,13 +115,13 @@ public void modified(@Nullable final Map<String, Object> config) {
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 {
Expand Down

0 comments on commit 49cfb20

Please sign in to comment.