Subject: [PATCH] #23841: Bing: Automatically reload all tiles with `Error: Attribution is not loaded yet` after su...
---
Index: src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java b/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java
--- a/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java	(revision 19173)
+++ b/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java	(date 1723053220863)
@@ -136,6 +136,7 @@
         public void run() {
             BingAttributionData attributionLoader = new BingAttributionData();
             try {
+                if (true) throw new IOException("Temp exception");
                 String xml = attributionLoader.updateIfRequiredString();
                 List<Attribution> ret;
                 try (StringReader sr = new StringReader(xml)) {
Index: src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java b/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
--- a/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 19173)
+++ b/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(date 1723053444472)
@@ -965,6 +965,15 @@
         invalidate();
     }
 
+    /**
+     * Remove all cached error tiles
+     * @since xxx
+     */
+    public void clearAllErrorTiles() {
+        tileCache.clearErrorTiles();
+        invalidate();
+    }
+
     @Override
     public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
         boolean done = (infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0;
Index: src/org/openstreetmap/josm/gui/layer/TMSLayer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/layer/TMSLayer.java b/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
--- a/src/org/openstreetmap/josm/gui/layer/TMSLayer.java	(revision 19173)
+++ b/src/org/openstreetmap/josm/gui/layer/TMSLayer.java	(date 1723053444461)
@@ -21,6 +21,7 @@
 import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader;
 import org.openstreetmap.josm.data.preferences.BooleanProperty;
 import org.openstreetmap.josm.data.preferences.IntegerProperty;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.Logging;
 
 /**
@@ -75,8 +76,8 @@
     @Override
     protected TMSTileSource getTileSource() {
         return getTileSourceStatic(info, () -> {
-            Logging.debug("Attribution loaded, running loadAllErrorTiles");
-            this.loadAllErrorTiles(false);
+            Logging.debug("Attribution loaded, running clearAllErrorTiles");
+            this.clearAllErrorTiles();
         });
     }
 
