- Timestamp:
- 2015-10-01T21:45:34+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r8768 r8815 166 166 167 167 try { 168 if (!tile.isLoaded()) { //if someone else already loaded tile, skip all the handling169 168 tile.finishLoading(); // whatever happened set that loading has finished 170 169 // set tile metadata … … 178 177 case SUCCESS: 179 178 handleNoTileAtZoom(); 180 if (object != null) {181 byte[] content = object.getContent();182 if (content != null && content.length > 0) {183 tile.loadImage(new ByteArrayInputStream(content));184 if (tile.getImage() == null) {185 tile.setError(tr("Could not load image from tile server"));186 status = false;187 }188 }189 }190 179 int httpStatusCode = attributes.getResponseCode(); 191 180 if (!isNoTileAtZoom() && httpStatusCode >= 400) { … … 197 186 status = false; 198 187 } 188 status &= tryLoadTileImage(object); //try to keep returned image as background 199 189 break; 200 190 case FAILURE: 201 191 tile.setError("Problem loading tile"); 202 // no break intentional here192 tryLoadTileImage(object); 203 193 break; 204 194 case CANCELED: … … 206 196 // do nothing 207 197 } 208 }209 198 210 199 // always check, if there is some listener interested in fact, that tile has finished loading … … 327 316 } 328 317 329 318 private boolean tryLoadTileImage(CacheEntry object) throws IOException { 319 if (object != null) { 320 byte[] content = object.getContent(); 321 if (content != null && content.length > 0) { 322 tile.loadImage(new ByteArrayInputStream(content)); 323 if (tile.getImage() == null) { 324 tile.setError(tr("Could not load image from tile server")); 325 return false; 326 } 327 } 328 } 329 return true; 330 } 330 331 }
Note:
See TracChangeset
for help on using the changeset viewer.