Ignore:
Timestamp:
2020-11-22T22:54:01+01:00 (3 years ago)
Author:
Don-vip
Message:

fix #20131 - remote control: report errors in case of OSM API error (load_and_zoom) or no valid identifier (load_object)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java

    r16770 r17330  
    99import java.awt.geom.Area;
    1010import java.awt.geom.Rectangle2D;
    11 import java.util.ArrayList;
    1211import java.util.Collection;
    1312import java.util.LinkedHashSet;
     
    3534import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    3635import org.openstreetmap.josm.gui.util.GuiHelper;
    37 import org.openstreetmap.josm.tools.ExceptionUtil;
    3836import org.openstreetmap.josm.tools.ImageProvider;
    3937import org.openstreetmap.josm.tools.Logging;
     
    247245                }
    248246            }
    249             Set<Object> errors = tasks.stream().flatMap(t -> t.getErrorObjects().stream()).collect(Collectors.toSet());
     247            Set<String> errors = tasks.stream().flatMap(t -> t.getErrorMessages().stream()).collect(Collectors.toSet());
    250248            if (!errors.isEmpty()) {
    251                 final Collection<String> items = new ArrayList<>();
    252                 for (Object error : errors) {
    253                     if (error instanceof String) {
    254                         items.add((String) error);
    255                     } else if (error instanceof Exception) {
    256                         items.add(ExceptionUtil.explainException((Exception) error));
    257                     }
    258                 }
    259 
    260249                GuiHelper.runInEDT(() -> {
    261                     if (items.size() == 1 && PostDownloadHandler.isNoDataErrorMessage(items.iterator().next())) {
    262                         new Notification(items.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show();
     250                    if (errors.size() == 1 && PostDownloadHandler.isNoDataErrorMessage(errors.iterator().next())) {
     251                        new Notification(errors.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show();
    263252                    } else {
    264253                        JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "<html>"
    265254                                + tr("The following errors occurred during mass download: {0}",
    266                                         Utils.joinAsHtmlUnorderedList(items)) + "</html>",
     255                                        Utils.joinAsHtmlUnorderedList(errors)) + "</html>",
    267256                                tr("Errors during download"), JOptionPane.ERROR_MESSAGE);
    268257                        return;
Note: See TracChangeset for help on using the changeset viewer.