Changeset 16203 in josm


Ignore:
Timestamp:
2020-03-27T10:18:45+01:00 (5 years ago)
Author:
GerdP
Message:

see #18985: avoid to download parents of deleted (invisble) objects

  • filter invisible objects before starting DownloadReferrersTask
  • don't show "retrying with an individual request for each object" for a rc 404 when only one object was requested
Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java

    r15787 r16203  
    114114        currentTask.run();
    115115        // Then, download referrers for each primitive
    116         if (downloadReferrers) {
    117             currentTask = new DownloadReferrersTask(tmpLayer, ids);
    118             currentTask.run();
    119             synchronized (this) {
    120                 if (currentTask.getProgressMonitor().isCanceled())
    121                     cancel();
     116        if (downloadReferrers && tmpLayer.data != null) {
     117            // see #18895: don't try to download parents for invisible objects
     118            List<PrimitiveId> visible = ids.stream().map(tmpLayer.data::getPrimitiveById)
     119                    .filter(p -> p != null && p.isVisible()).collect(Collectors.toList());
     120            if (!visible.isEmpty()) {
     121                currentTask = new DownloadReferrersTask(tmpLayer, visible);
     122                currentTask.run();
     123                synchronized (this) {
     124                    if (currentTask.getProgressMonitor().isCanceled())
     125                        cancel();
     126                }
    122127            }
    123128        }
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r16008 r16203  
    578578                        return res;
    579579                    }
    580                     Logging.info(tr("Server replied with response code 404, retrying with an individual request for each object."));
    581                     return singleGetIdPackage(type, pkg, progressMonitor);
     580                    if (pkg.size() == 1) {
     581                        FetchResult res = new FetchResult(new DataSet(), new HashSet<PrimitiveId>());
     582                        res.missingPrimitives.add(new SimplePrimitiveId(pkg.iterator().next(), type));
     583                        return res;
     584                    } else {
     585                        Logging.info(tr("Server replied with response code 404, retrying with an individual request for each object."));
     586                        return singleGetIdPackage(type, pkg, progressMonitor);
     587                    }
    582588                } else {
    583589                    throw e;
Note: See TracChangeset for help on using the changeset viewer.