Changeset 8488 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-06-12T22:51:43+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/cache/BufferedImageCacheEntry.java
r8470 r8488 20 20 private transient volatile BufferedImage img = null; 21 21 private transient volatile boolean writtenToDisk = false; 22 // we need to have separate control variable, to know, if we already tried to load the image, as img might be null 23 // after we loaded image, as for example, when image file is malformed (eg. HTML file) 24 private transient volatile boolean imageLoaded = false; 22 25 23 26 /** … … 37 40 */ 38 41 public BufferedImage getImage() throws IOException { 39 if (im g != null)42 if (imageLoaded) 40 43 return img; 41 44 synchronized(this) { 42 if (im g != null)45 if (imageLoaded) 43 46 return img; 44 47 byte[] content = getContent(); 45 48 if (content != null && content.length > 0) { 46 49 img = ImageIO.read(new ByteArrayInputStream(content)); 50 imageLoaded = true; 47 51 48 52 if (writtenToDisk) -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r8459 r8488 193 193 if (content != null && content.length > 0) { 194 194 tile.loadImage(new ByteArrayInputStream(content)); 195 if (tile.getImage() == null) { 196 tile.setError(tr("Could not load image from tile server")); 197 status = false; 198 } 195 199 } 196 200 } … … 242 246 } 243 247 244 if (data != null && data.getImage() != null) { 245 tile.setImage(data.getImage()); 246 tile.finishLoading(); 248 if (data != null) { 249 if (data.getImage() != null) { 250 tile.setImage(data.getImage()); 251 tile.finishLoading(); 252 } else { 253 // we had some data, but we didn't get any image. Malformed image? 254 tile.setError(tr("Could not load image from tile server")); 255 } 247 256 } 248 257 if (isNoTileAtZoom()) {
Note:
See TracChangeset
for help on using the changeset viewer.