Index: trunk/src/org/openstreetmap/josm/data/Bounds.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Bounds.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/Bounds.java	(revision 11587)
@@ -477,12 +477,19 @@
     }
 
+    /**
+     * Determines if these bounds are out of the world.
+     * @return true if lat outside of range [-90,90] or lon outside of range [-180,180]
+     */
     public boolean isOutOfTheWorld() {
         return
-        minLat < -90 || minLat > 90 ||
-        maxLat < -90 || maxLat > 90 ||
-        minLon < -180 || minLon > 180 ||
-        maxLon < -180 || maxLon > 180;
-    }
-
+        !LatLon.isValidLat(minLat) ||
+        !LatLon.isValidLat(maxLat) ||
+        !LatLon.isValidLon(minLon) ||
+        !LatLon.isValidLon(maxLon);
+    }
+
+    /**
+     * Clamp the bounds to be inside the world.
+     */
     public void normalize() {
         minLat = LatLon.toIntervalLat(minLat);
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11587)
@@ -499,4 +499,5 @@
         }
 
+        // CHECKSTYLE.OFF: BooleanExpressionComplexity
         return
                 Objects.equals(this.name, other.name) &&
@@ -527,4 +528,5 @@
                 Objects.equals(this.metadataHeaders, other.metadataHeaders) &&
                 Objects.equals(this.defaultLayers, other.defaultLayers);
+        // CHECKSTYLE.ON: BooleanExpressionComplexity
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java	(revision 11587)
@@ -725,4 +725,15 @@
 
     /**
+     * Replies true if this primitive has a tag any of the <code>keys</code>.
+     *
+     * @param keys the keys
+     * @return true, if his primitive has a tag with any of the <code>keys</code>
+     * @since 11587
+     */
+    public boolean hasKey(String ... keys) {
+        return keys != null && Arrays.stream(keys).anyMatch(this::hasKey);
+    }
+
+    /**
      * What to do, when the tags have changed by one of the tag-changing methods.
      * @param originalKeys original tags
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 11587)
@@ -1178,4 +1178,5 @@
      */
     public boolean hasEqualTechnicalAttributes(OsmPrimitive other) {
+        // CHECKSTYLE.OFF: BooleanExpressionComplexity
         return other != null
             && timestamp == other.timestamp
@@ -1186,4 +1187,5 @@
             && isVisible() == other.isVisible()
             && Objects.equals(user, other.user);
+        // CHECKSTYLE.ON: BooleanExpressionComplexity
     }
 
@@ -1354,9 +1356,5 @@
                 || "yes".equals(get("area"))
                 || "riverbank".equals(get("waterway"))
-                || hasKey("natural")
-                || hasKey("amenity")
-                || hasKey("leisure")
-                || hasKey("building")
-                || hasKey("building:part");
+                || hasKey("natural", "amenity", "leisure", "building", "building:part");
     }
 
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 11587)
@@ -57,7 +57,7 @@
             return super.isPrimitiveUsable(w)
                     && !isProposedOrAbandoned(w)
-                    && ((w.hasKey(HIGHWAY) && !w.hasTag(HIGHWAY, "rest_area", "services"))
+                    && (isHighway(w)
                     || w.hasKey(WATERWAY)
-                    || (w.hasKey(RAILWAY) && !isSubwayOrTramOrRazed(w))
+                    || isRailway(w)
                     || isCoastline(w)
                     || isBuilding(w));
@@ -238,4 +238,12 @@
     static boolean isCoastline(OsmPrimitive w) {
         return w.hasTag("natural", "water", "coastline") || w.hasTag("landuse", "reservoir");
+    }
+
+    static boolean isHighway(OsmPrimitive w) {
+        return w.hasKey(HIGHWAY) && !w.hasTag(HIGHWAY, "rest_area", "services");
+    }
+
+    static boolean isRailway(OsmPrimitive w) {
+        return w.hasKey(RAILWAY) && !isSubwayOrTramOrRazed(w);
     }
 
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java	(revision 11587)
@@ -111,5 +111,5 @@
         @Override
         public boolean isPrimitiveUsable(OsmPrimitive p) {
-            return super.isPrimitiveUsable(p) && (p.hasKey("natural") || p.hasKey("landuse"));
+            return super.isPrimitiveUsable(p) && p.hasKey("natural", "landuse");
         }
     }
@@ -185,6 +185,5 @@
                             || en.hasTag("railway", "buffer_stop")
                             || en.isKeyTrue("noexit")
-                            || en.hasKey("entrance")
-                            || en.hasKey("barrier")) {
+                            || en.hasKey("entrance", "barrier")) {
                         continue;
                     }
@@ -451,5 +450,5 @@
             ways.addAll(getWaySegments(w));
             QuadBuckets<Node> set = endnodes;
-            if (w.hasKey("highway") || w.hasKey("railway")) {
+            if (w.hasKey("highway", "railway")) {
                 set = endnodesHighway;
             }
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java	(revision 11587)
@@ -81,6 +81,5 @@
 
     private static boolean isArea(OsmPrimitive p) {
-        return (p.hasKey("landuse") || p.hasKey("natural"))
-                && ElemStyles.hasAreaElemStyle(p, false);
+        return p.hasKey("landuse", "natural") && ElemStyles.hasAreaElemStyle(p, false);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSortUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSortUtils.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSortUtils.java	(revision 11587)
@@ -7,4 +7,5 @@
 
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
@@ -28,21 +29,22 @@
 
     static Direction roundaboutType(Way w) {
-        if (w != null &&
-                "roundabout".equals(w.get("junction")) &&
-                w.getNodesCount() < 200 &&
-                w.getNodesCount() > 2 &&
-                w.getNode(0) != null &&
-                w.getNode(1) != null &&
-                w.getNode(2) != null &&
-                w.isClosed()) {
-            /** do some simple determinant / cross pruduct test on the first 3 nodes
-                to see, if the roundabout goes clock wise or ccw */
-            EastNorth en1 = w.getNode(0).getEastNorth();
-            EastNorth en2 = w.getNode(1).getEastNorth();
-            EastNorth en3 = w.getNode(2).getEastNorth();
-            if (en1 != null && en2 != null && en3 != null) {
-                en1 = en2.subtract(en1);
-                en2 = en3.subtract(en2);
-                return en1.north() * en2.east() - en2.north() * en1.east() > 0 ? ROUNDABOUT_LEFT : ROUNDABOUT_RIGHT;
+        if (w != null && "roundabout".equals(w.get("junction"))) {
+            int nodesCount = w.getNodesCount();
+            if (nodesCount > 2 && nodesCount < 200) {
+                Node n1 = w.getNode(0);
+                Node n2 = w.getNode(1);
+                Node n3 = w.getNode(2);
+                if (n1 != null && n2 != null && n3 != null && w.isClosed()) {
+                    /** do some simple determinant / cross pruduct test on the first 3 nodes
+                        to see, if the roundabout goes clock wise or ccw */
+                    EastNorth en1 = n1.getEastNorth();
+                    EastNorth en2 = n2.getEastNorth();
+                    EastNorth en3 = n3.getEastNorth();
+                    if (en1 != null && en2 != null && en3 != null) {
+                        en1 = en2.subtract(en1);
+                        en2 = en3.subtract(en2);
+                        return en1.north() * en2.east() - en2.north() * en1.east() > 0 ? ROUNDABOUT_LEFT : ROUNDABOUT_RIGHT;
+                    }
+                }
             }
         }
Index: trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 11587)
@@ -1352,4 +1352,5 @@
      */
     private void checkCache() {
+        // CHECKSTYLE.OFF: BooleanExpressionComplexity
         if ((computeCacheMaxLineLengthUsed != maxLineLength)
                 || (computeCacheColored != colored)
@@ -1361,5 +1362,6 @@
                 || (computeCacheHeatMapDrawGain != heatMapDrawGain))
                 || (computeCacheHeatMapDrawLowerLimit != heatMapDrawLowerLimit)
-      ) {
+        ) {
+            // CHECKSTYLE.ON: BooleanExpressionComplexity
             computeCacheMaxLineLengthUsed = maxLineLength;
             computeCacheInSync = false;
Index: trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 11586)
+++ trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 11587)
@@ -268,9 +268,17 @@
         return ImageIO.getImageReadersByMIMEType(format).hasNext()
                 // handles image/tiff image/tiff8 image/geotiff image/geotiff8
-                || ((format.startsWith("image/tiff") || format.startsWith("image/geotiff"))
-                        && ImageIO.getImageReadersBySuffix("tiff").hasNext())
-                || (format.startsWith("image/png") && ImageIO.getImageReadersBySuffix("png").hasNext())
-                || (format.startsWith("image/svg") && ImageIO.getImageReadersBySuffix("svg").hasNext())
-                || (format.startsWith("image/bmp") && ImageIO.getImageReadersBySuffix("bmp").hasNext());
+                || isImageFormatSupported(format, "tiff", "geotiff")
+                || isImageFormatSupported(format, "png")
+                || isImageFormatSupported(format, "svg")
+                || isImageFormatSupported(format, "bmp");
+    }
+
+    static boolean isImageFormatSupported(String format, String ... mimeFormats) {
+        for (String mime : mimeFormats) {
+            if (format.startsWith("image/" + mime)) {
+                return ImageIO.getImageReadersBySuffix(mimeFormats[0]).hasNext();
+            }
+        }
+        return false;
     }
 
