Skip to content

Commit

Permalink
Fix #22509: stale URLs may cause downloads to fail
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Nov 17, 2022
1 parent 6d1ab18 commit ee0c576
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import static org.openstreetmap.josm.tools.I18n.tr;

import javax.swing.JOptionPane;

import java.awt.geom.Area;
import java.io.InputStream;
import java.net.SocketTimeoutException;
Expand Down Expand Up @@ -33,6 +35,7 @@
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflationCategory;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
import org.openstreetmap.josm.tools.HttpClient;
Expand Down Expand Up @@ -117,6 +120,15 @@ public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferExcep
GuiHelper.runInEDT(() -> note.setContent(tr(
"Attempting to download data in the background. This may fail or succeed in a few minutes.")));
GuiHelper.runInEDT(note::show);
} else if (e.getCause() instanceof IllegalDataException) {
MapWithAILayerInfo.getInstance().loadDefaults(true, MapWithAIDataUtils.getForkJoinPool(), false,
() -> GuiHelper.runInEDT(() -> {
Notification notification = new Notification(tr(
"MapWithAI layers reloaded. Removing and re-adding the MapWithAI layer may be necessary."));
notification.setIcon(JOptionPane.INFORMATION_MESSAGE);
notification.setDuration(Notification.TIME_LONG);
notification.show();
}));
} else {
throw e;
}
Expand Down

0 comments on commit ee0c576

Please sign in to comment.