Changeset 16205 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-03-27T15:39:19+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java
r16123 r16205 7 7 import java.awt.Component; 8 8 import java.io.IOException; 9 import java.net.HttpURLConnection; 9 10 import java.util.ArrayList; 10 11 import java.util.Collection; 11 import java.util. HashSet;12 import java.util.LinkedHashSet; 12 13 import java.util.List; 13 14 import java.util.Objects; … … 24 25 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 25 26 import org.openstreetmap.josm.io.ChangesetQuery; 27 import org.openstreetmap.josm.io.OsmApiException; 26 28 import org.openstreetmap.josm.io.OsmServerChangesetReader; 27 29 import org.openstreetmap.josm.io.OsmServerHistoryReader; … … 51 53 private boolean canceled; 52 54 private Exception lastException; 53 private final Set<PrimitiveId> toLoad = new HashSet<>();55 private final Set<PrimitiveId> toLoad = new LinkedHashSet<>(); 54 56 private HistoryDataSet loadedData; 55 57 private OsmServerHistoryReader reader; 56 58 private boolean getChangesetData = true; 59 private boolean collectMissing; 60 private final Set<PrimitiveId> missingPrimitives = new LinkedHashSet<>(); 57 61 58 62 /** … … 194 198 progressMonitor.indeterminateSubTask(tr(msg, Long.toString(pid.getUniqueId()))); 195 199 reader = null; 196 HistoryDataSet ds ;200 HistoryDataSet ds = null; 197 201 try { 198 202 reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId()); … … 202 206 ds = reader.parseHistory(progressMonitor.createSubTaskMonitor(1, false)); 203 207 } 208 } catch (OsmApiException e) { 209 if (canceled) 210 return; 211 if (e.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND && collectMissing) { 212 missingPrimitives.add(pid); 213 } else { 214 throw e; 215 } 204 216 } catch (OsmTransferException e) { 205 217 if (canceled) … … 207 219 throw e; 208 220 } 209 loadedData.mergeInto(ds); 221 if (ds != null) { 222 loadedData.mergeInto(ds); 223 } 210 224 } 211 225 … … 267 281 getChangesetData = b; 268 282 } 283 284 /** 285 * Determine if missing primitives should be collected. By default they are not collected 286 * and the first missing object terminates the task. 287 * @param b true means collect missing data and continue. 288 * @since 16205 289 */ 290 public void setCollectMissing(boolean b) { 291 collectMissing = b; 292 } 293 294 /** 295 * replies the set of ids of all primitives for which a fetch request to the 296 * server was submitted but which are not available from the server (the server 297 * replied a return code of 404) 298 * @since 16205 299 * 300 * @return the set of ids of missing primitives 301 */ 302 public Set<PrimitiveId> getMissingPrimitives() { 303 return missingPrimitives; 304 } 305 269 306 }
Note:
See TracChangeset
for help on using the changeset viewer.