Changeset 15812 in josm for trunk/src/org


Ignore:
Timestamp:
2020-02-03T08:26:24+01:00 (5 years ago)
Author:
GerdP
Message:

see #18566: fix findbugs UWF_UNWRITTEN_FIELD introduced with r15811

To be honest, I don't understand the synchronized (this) blocks in the code. Looks like an incomplete approach to implement a "download in background". Hope this change doesn't block anything.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationTask.java

    r15811 r15812  
    1919import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2020import org.openstreetmap.josm.io.MultiFetchServerObjectReader;
    21 import org.openstreetmap.josm.io.OsmServerReader;
    2221import org.openstreetmap.josm.io.OsmTransferException;
    2322import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    3534    private final Collection<Relation> relations;
    3635    private final OsmDataLayer layer;
    37     private OsmServerReader objectReader;
     36    private MultiFetchServerObjectReader multiObjectReader;
    3837
    3938    /**
     
    6059        canceled = true;
    6160        synchronized (this) {
    62             if (objectReader != null) {
    63                 objectReader.cancel();
     61            if (multiObjectReader != null) {
     62                multiObjectReader.cancel();
    6463            }
    6564        }
     
    8079            final DataSet allDownloads = new DataSet();
    8180            getProgressMonitor().setTicksCount(relations.size());
    82             MultiFetchServerObjectReader multiObjectReader;
     81            DataSet dataSet = null;
    8382            synchronized (this) {
    8483                if (canceled)
    8584                    return;
    8685                multiObjectReader = MultiFetchServerObjectReader.create();
     86                multiObjectReader.setRecurseDownRelations(true).setRecurseDownAppended(false);
     87                multiObjectReader.append(relations);
     88                dataSet = multiObjectReader.parseOsm(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
    8789            }
    88             multiObjectReader.setRecurseDownRelations(true).setRecurseDownAppended(false);
    89             multiObjectReader.append(relations);
    90             DataSet dataSet = multiObjectReader.parseOsm(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
    9190            if (dataSet == null)
    9291                return;
Note: See TracChangeset for help on using the changeset viewer.