Ignore:
Timestamp:
2017-02-19T23:52:08+01:00 (3 years ago)
Author:
Don-vip
Message:

checkstyle - enable BooleanExpressionComplexity / 6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r11381 r11587  
    268268        return ImageIO.getImageReadersByMIMEType(format).hasNext()
    269269                // handles image/tiff image/tiff8 image/geotiff image/geotiff8
    270                 || ((format.startsWith("image/tiff") || format.startsWith("image/geotiff"))
    271                         && ImageIO.getImageReadersBySuffix("tiff").hasNext())
    272                 || (format.startsWith("image/png") && ImageIO.getImageReadersBySuffix("png").hasNext())
    273                 || (format.startsWith("image/svg") && ImageIO.getImageReadersBySuffix("svg").hasNext())
    274                 || (format.startsWith("image/bmp") && ImageIO.getImageReadersBySuffix("bmp").hasNext());
     270                || isImageFormatSupported(format, "tiff", "geotiff")
     271                || isImageFormatSupported(format, "png")
     272                || isImageFormatSupported(format, "svg")
     273                || isImageFormatSupported(format, "bmp");
     274    }
     275
     276    static boolean isImageFormatSupported(String format, String ... mimeFormats) {
     277        for (String mime : mimeFormats) {
     278            if (format.startsWith("image/" + mime)) {
     279                return ImageIO.getImageReadersBySuffix(mimeFormats[0]).hasNext();
     280            }
     281        }
     282        return false;
    275283    }
    276284
Note: See TracChangeset for help on using the changeset viewer.