Index: /trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java	(revision 8625)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java	(revision 8626)
@@ -8,7 +8,8 @@
 import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
-import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Matcher;
@@ -37,5 +38,5 @@
 public class TemplatedWMSTileSource extends TMSTileSource implements TemplatedTileSource {
     private Map<String, String> headers = new ConcurrentHashMap<>();
-    private final List<String> serverProjections;
+    private final Set<String> serverProjections;
     private EastNorth topLeftCorner;
     private Bounds worldBounds;
@@ -63,5 +64,5 @@
     public TemplatedWMSTileSource(ImageryInfo info) {
         super(info);
-        this.serverProjections = info.getServerProjections();
+        this.serverProjections = new TreeSet<>(info.getServerProjections());
         handleTemplate();
         initProjection();
@@ -143,7 +144,7 @@
         // CHECKSTYLE.ON: LineLength
         boolean switchLatLon = false;
-        if (baseUrl.toLowerCase().contains("crs=epsg:4326")) {
+        if (baseUrl.toLowerCase(Locale.US).contains("crs=epsg:4326")) {
             switchLatLon = true;
-        } else if (baseUrl.toLowerCase().contains("crs=")) {
+        } else if (baseUrl.toLowerCase(Locale.US).contains("crs=")) {
             // assume WMS 1.3.0
             switchLatLon = Main.getProjection().switchXY();
@@ -354,5 +355,5 @@
         EastNorth max = proj.latlon2eastNorth(worldBounds.getMax());
 
-        int tilesPerZoom = (int) Math.pow(2, zoom - 1);
+        int tilesPerZoom = (int) Math.pow(2d, zoom - 1);
         return Math.max(
                 Math.abs(max.getY() - min.getY()) / tilesPerZoom,
@@ -366,5 +367,5 @@
      * pole, the same way they are capped in Mercator projection, so conversions should work properly
      */
-    private final static Bounds getWorldBounds() {
+    private static Bounds getWorldBounds() {
         Projection proj = Main.getProjection();
         Bounds bounds = proj.getWorldBoundsLatLon();
