From d56513358da8c91009dd658db27aad189b0ec8cc Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Fri, 5 Jan 2024 06:16:54 -0700 Subject: [PATCH] Fix #23390: Progress Monitor needs to send child monitors to avoid being in the finished state Signed-off-by: Taylor Smock --- .../mapwithai/backend/BoundingBoxMapWithAIDownloader.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java index a0b42e7b..87a5124d 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/backend/BoundingBoxMapWithAIDownloader.java @@ -330,19 +330,22 @@ private DataSet readMvt(InputStream source, ProgressMonitor progressMonitor) thr } ds = new DataSet(); final var currentBounds = new Bounds(this.downloadArea); + progressMonitor.beginTask(tr("Downloading data"), 2 * tiles.size()); for (TileXYZ tileXYZ : tiles) { try { final var hilbert = PMTiles.convertToHilbert(tileXYZ.z(), tileXYZ.x(), tileXYZ.y()); final var data = this.info.getSourceType() == MapWithAIType.PMTILES ? new ByteArrayInputStream(PMTiles.readData(header, hilbert, cachedDirectories)) - : getInputStream(getRequestForTile(tileXYZ), progressMonitor); + : getInputStream(getRequestForTile(tileXYZ), progressMonitor.createSubTaskMonitor(1, true)); final var dataSet = loadTile(tileSource, tileXYZ, data); - ds.mergeFrom(dataSet, progressMonitor); + ds.mergeFrom(dataSet, progressMonitor.createSubTaskMonitor(1, true)); tileXYZ.expandBounds(currentBounds); } catch (OsmTransferException | IOException e) { + progressMonitor.finishTask(); throw new IllegalDataException(e); } } + progressMonitor.finishTask(); ds.addDataSource(new DataSource(currentBounds, this.url)); return ds; }