Ticket #19194: 19194.1.patch

File 19194.1.patch, 1.4 KB (added by taylor.smock, 5 years ago)

Remove duplicates had a slight bug. remove if (required plugins don't contain the plugin name or provides) OR if the plugin is not for the current platform (might be redundant). Instead of remove if (required plugins don't contain the plugin name or provides) and is for the current platform.

  • src/org/openstreetmap/josm/plugins/PluginHandler.java

     
    599599        MainApplication.worker.submit(() -> {
    600600            // Build list of plugins to download
    601601            Set<PluginInformation> toDownload = new HashSet<>(pluginInfoDownloadTask.getAvailablePlugins());
    602             toDownload.removeIf(info -> !missingRequiredPlugin.contains(info.getName()));
     602            toDownload.removeIf(info -> !missingRequiredPlugin.contains(info.getName())
     603                    && !missingRequiredPlugin.contains(info.provides) || !info.isForCurrentPlatform());
     604            // Remove duplicates
     605            Set<String> possibleDuplicates = toDownload.parallelStream()
     606                    .collect(Collectors.groupingBy(i -> i.provides == null ? i.getName() : i.provides, Collectors.counting()))
     607                    .entrySet().stream().filter(e -> e.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
     608            toDownload.removeIf(i -> possibleDuplicates.contains(i.getName()) || possibleDuplicates.contains(i.provides));
    603609            // Check if something has still to be downloaded
    604610            if (!toDownload.isEmpty()) {
    605611                // download plugins