Changeset 11559 in josm


Ignore:
Timestamp:
2017-02-14T00:21:56+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14361 - WMTS: download only supported image formats

Location:
trunk/src/org/openstreetmap/josm/data/imagery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r11553 r11559  
    110110        if (url == null) {
    111111            synchronized (this) {
    112                 if (url == null)
    113                     url = new URL(tile.getUrl());
     112                if (url == null) {
     113                    String sUrl = tile.getUrl();
     114                    if (!"".equals(sUrl)) {
     115                        url = new URL(sUrl);
     116                    }
     117                }
    114118            }
    115119        }
     
    151155        try {
    152156            super.submit(this, force);
    153         } catch (IOException e) {
     157        } catch (IOException | IllegalArgumentException e) {
    154158            // if we fail to submit the job, mark tile as loaded and set error message
    155159            Main.warn(e, false);
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r11553 r11559  
    1111import java.nio.charset.StandardCharsets;
    1212import java.util.ArrayList;
     13import java.util.Arrays;
    1314import java.util.Collection;
    1415import java.util.Collections;
     
    1718import java.util.Map;
    1819import java.util.Map.Entry;
     20import java.util.Objects;
    1921import java.util.Optional;
    2022import java.util.Set;
     
    2729import java.util.stream.Collectors;
    2830
     31import javax.imageio.ImageIO;
    2932import javax.swing.JPanel;
    3033import javax.swing.JScrollPane;
     
    148151
    149152        Layer(Layer l) {
    150             if (l != null) {
    151                 format = l.format;
    152                 name = l.name;
    153                 baseUrl = l.baseUrl;
    154                 style = l.style;
    155                 tileMatrixSet = new TileMatrixSet(l.tileMatrixSet);
    156             }
     153            Objects.requireNonNull(l);
     154            format = l.format;
     155            name = l.name;
     156            baseUrl = l.baseUrl;
     157            style = l.style;
     158            tileMatrixSet = new TileMatrixSet(l.tileMatrixSet);
    157159        }
    158160
     
    384386        Layer layer = new Layer();
    385387        Stack<QName> tagStack = new Stack<>();
     388        List<String> supportedMimeTypes = Arrays.asList(ImageIO.getReaderMIMETypes());
    386389
    387390        for (int event = reader.getEventType();
     
    392395                if (tagStack.size() == 2) {
    393396                    if (QN_FORMAT.equals(reader.getName())) {
    394                         layer.format = reader.getElementText();
     397                        String format = reader.getElementText();
     398                        if (supportedMimeTypes.contains(format)) {
     399                            layer.format = format;
     400                        }
    395401                    } else if (GetCapabilitiesParseHelper.QN_OWS_IDENTIFIER.equals(reader.getName())) {
    396402                        layer.name = reader.getElementText();
Note: See TracChangeset for help on using the changeset viewer.