Index: /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 8570)
@@ -110,5 +110,5 @@
         }
 
-        private final String getTypeString() {
+        private String getTypeString() {
             return typeString;
         }
@@ -124,5 +124,5 @@
     }
 
-    private class SelectLayerDialog extends ExtendedDialog {
+    private final class SelectLayerDialog extends ExtendedDialog {
         private Layer[] layers;
         private JList<String> list;
@@ -133,5 +133,5 @@
             this.list = new JList<>(getLayerNames(layers));
             this.list.setPreferredSize(new Dimension(400, 400));
-            this.list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) ;
+            this.list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             JPanel panel = new JPanel(new GridBagLayout());
             panel.add(this.list, GBC.eol().fill());
@@ -141,5 +141,5 @@
         private String[] getLayerNames(Collection<Layer> layers) {
             Collection<String> ret = new ArrayList<>();
-            for(Layer layer: layers) {
+            for (Layer layer: layers) {
                 ret.add(layer.name);
             }
@@ -167,5 +167,5 @@
      * Creates a tile source based on imagery info
      * @param info imagery info
-     * @throws IOException
+     * @throws IOException if any I/O error occurs
      */
     public WMTSTileSource(ImageryInfo info) throws IOException {
@@ -189,6 +189,4 @@
         initProjection();
     }
-
-
 
     private String handleTemplate(String url) {
@@ -222,7 +220,9 @@
             }
             Document document = builder.parse(new ByteArrayInputStream(data));
-            Node getTileOperation = getByXpath(document, "/Capabilities/OperationsMetadata/Operation[@name=\"GetTile\"]/DCP/HTTP/Get").item(0);
+            Node getTileOperation = getByXpath(document,
+                    "/Capabilities/OperationsMetadata/Operation[@name=\"GetTile\"]/DCP/HTTP/Get").item(0);
             this.baseUrl = getStringByXpath(getTileOperation, "@href");
-            this.transferMode = TransferMode.fromString(getStringByXpath(getTileOperation, "Constraint[@name=\"GetEncoding\"]/AllowedValues/Value"));
+            this.transferMode = TransferMode.fromString(getStringByXpath(getTileOperation,
+                    "Constraint[@name=\"GetEncoding\"]/AllowedValues/Value"));
             NodeList layersNodeList = getByXpath(document, "/Capabilities/Contents/Layer");
             Map<String, TileMatrixSet> matrixSetById = parseMatrices(getByXpath(document, "/Capabilities/Contents/TileMatrixSet"));
@@ -231,5 +231,4 @@
         } catch (Exception e) {
             Main.error(e);
-            //Main.error(new String(data, "UTF-8"));
         }
         return null;
@@ -242,5 +241,5 @@
     }
 
-    private final Collection<Layer> parseLayer(NodeList nodeList, Map<String, TileMatrixSet> matrixSetById) throws XPathExpressionException {
+    private Collection<Layer> parseLayer(NodeList nodeList, Map<String, TileMatrixSet> matrixSetById) throws XPathExpressionException {
         Collection<Layer> ret = new ArrayList<>();
         for (int layerId = 0; layerId < nodeList.getLength(); layerId++) {
@@ -262,5 +261,5 @@
     }
 
-    private final Map<String, TileMatrixSet> parseMatrices(NodeList nodeList) throws DOMException, XPathExpressionException {
+    private Map<String, TileMatrixSet> parseMatrices(NodeList nodeList) throws DOMException, XPathExpressionException {
         Map<String, TileMatrixSet> ret = new ConcurrentHashMap<>();
         for (int matrixSetId = 0; matrixSetId < nodeList.getLength(); matrixSetId++) {
@@ -292,9 +291,10 @@
 
     private static String crsToCode(String crsIdentifier) {
-        if(crsIdentifier.startsWith("urn:ogc:def:crs:")) {
+        if (crsIdentifier.startsWith("urn:ogc:def:crs:")) {
             return crsIdentifier.replaceFirst("urn:ogc:def:crs:([^:]*):[^:]*:(.*)$", "$1:$2");
         }
         return crsIdentifier;
     }
+
     private static String getStringByXpath(Node document, String xpathQuery) throws XPathExpressionException {
         return (String) getByXpath(document, xpathQuery, XPathConstants.STRING);
@@ -304,5 +304,4 @@
         return (NodeList) getByXpath(document, xpathQuery, XPathConstants.NODESET);
     }
-
 
     private static Object getByXpath(Node document, String xpathQuery, QName returnType) throws XPathExpressionException {
@@ -325,10 +324,10 @@
     public void initProjection(Projection proj) {
         this.currentTileMatrixSet = currentLayer.tileMatrixSetByCRS.get(proj.toCode());
-        if(this.currentTileMatrixSet == null) {
+        if (this.currentTileMatrixSet == null) {
             Main.warn("Unsupported CRS selected");
             // take first, maybe it will work (if user sets custom projections, codes will not match)
             this.currentTileMatrixSet = currentLayer.tileMatrixSetByCRS.values().iterator().next();
         }
-        this.crsScale = getTileSize() * 0.28e-03 / proj.getMetersPerUnit() ;
+        this.crsScale = getTileSize() * 0.28e-03 / proj.getMetersPerUnit();
     }
 
@@ -381,5 +380,5 @@
     /**
      *
-     * @param zoom
+     * @param zoom zoom level
      * @return TileMatrix that's working on this zoom level
      */
@@ -423,5 +422,4 @@
         throw new UnsupportedOperationException("Not implemented");
     }
-
 
     @Override
@@ -513,5 +511,5 @@
     public Coordinate XYToLatLon(int x, int y, int zoom) {
         TileMatrix matrix = getTileMatrix(zoom);
-        if (matrix == null ){
+        if (matrix == null) {
             return new Coordinate(0, 0);
         }
Index: /trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 8570)
@@ -36,6 +36,6 @@
 public class CustomProjection extends AbstractProjection {
 
-    private final static Map<String, Double> UNITS_TO_METERS = getUnitsToMeters();
-    private final static double METER_PER_UNIT_DEGREE = 2 * Math.PI * 6370997 / 360;
+    private static final Map<String, Double> UNITS_TO_METERS = getUnitsToMeters();
+    private static final double METER_PER_UNIT_DEGREE = 2 * Math.PI * 6370997 / 360;
 
     /**
Index: /trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 8570)
@@ -276,5 +276,5 @@
 
     private final class ShowTileInfoAction extends AbstractAction {
-        private transient final TileHolder clickedTileHolder;
+        private final transient TileHolder clickedTileHolder;
 
         private ShowTileInfoAction(TileHolder clickedTileHolder) {
Index: /trunk/src/org/openstreetmap/josm/gui/layer/WMTSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/WMTSLayer.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/WMTSLayer.java	(revision 8570)
@@ -88,5 +88,5 @@
          LatLon botLeft = mv.getLatLon(0, tileSource.getTileSize());
 
-         return Math.abs((north.getLat() - south.getLat()) / ( topLeft.lat() - botLeft.lat()));
+         return Math.abs((north.getLat() - south.getLat()) / (topLeft.lat() - botLeft.lat()));
     }
 
@@ -95,5 +95,5 @@
         if (!Main.isDisplayingMapView()) return 1;
 
-        for(int i=getMinZoomLvl(); i <= getMaxZoomLvl(); i++) {
+        for (int i = getMinZoomLvl(); i <= getMaxZoomLvl(); i++) {
             double ret = getTileToScreenRatio(i);
             if (ret < 1) {
@@ -106,5 +106,5 @@
     @Override
     public boolean isProjectionSupported(Projection proj) {
-        return ((WMTSTileSource)tileSource).getSupportedProjections().contains(proj.toCode());
+        return ((WMTSTileSource) tileSource).getSupportedProjections().contains(proj.toCode());
     }
 
@@ -112,5 +112,5 @@
     public String nameSupportedProjections() {
         StringBuilder ret = new StringBuilder();
-        for (String e: ((WMTSTileSource)tileSource).getSupportedProjections()) {
+        for (String e: ((WMTSTileSource) tileSource).getSupportedProjections()) {
             ret.append(e).append(", ");
         }
@@ -121,6 +121,5 @@
     public void projectionChanged(Projection oldValue, Projection newValue) {
         super.projectionChanged(oldValue, newValue);
-        ((WMTSTileSource)tileSource).initProjection(newValue);
+        ((WMTSTileSource) tileSource).initProjection(newValue);
     }
-
 }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanel.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanel.java	(revision 8570)
@@ -29,4 +29,5 @@
         registerValidableComponent(rawUrl);
     }
+
     @Override
     protected ImageryInfo getImageryInfo() {
Index: /trunk/src/org/openstreetmap/josm/io/CachedFile.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 8570)
@@ -500,6 +500,6 @@
      * @since TODO
      */
-    public static HttpURLConnection connectFollowingRedirect(URL downloadUrl, String httpAccept, Long ifModifiedSince, Map<String, String> headers)
-            throws MalformedURLException, IOException {
+    public static HttpURLConnection connectFollowingRedirect(URL downloadUrl, String httpAccept, Long ifModifiedSince,
+            Map<String, String> headers) throws MalformedURLException, IOException {
         CheckParameterUtil.ensureParameterNotNull(downloadUrl, "downloadUrl");
         String downloadString = downloadUrl.toExternalForm();
Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 8569)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 8570)
@@ -1342,7 +1342,7 @@
      * Reads the input stream and closes the stream at the end of processing (regardless if an exception was thrown)
      *
-     * @param stream
+     * @param stream input stream
      * @return byte array of data in input stream
-     * @throws IOException
+     * @throws IOException if any I/O error occurs
      */
     public static byte[] readBytesFromStream(InputStream stream) throws IOException {
Index: /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java	(revision 8569)
+++ /trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java	(revision 8570)
@@ -50,16 +50,16 @@
         verifyMercatorTile(testSource, 0, 0, 2);
         verifyMercatorTile(testSource, 1, 1, 2);
-        for(int x = 0; x < 4; x++) {
-            for(int y = 0; y < 4; y++) {
+        for (int x = 0; x < 4; x++) {
+            for (int y = 0; y < 4; y++) {
                 verifyMercatorTile(testSource, x, y, 3);
             }
         }
-        for(int x = 0; x < 8; x++) {
-            for(int y = 0; y < 4; y++) {
+        for (int x = 0; x < 8; x++) {
+            for (int y = 0; y < 4; y++) {
                 verifyMercatorTile(testSource, x, y, 4);
             }
         }
 
-        verifyMercatorTile(testSource, 2<<9 - 1, 2<<8 - 1, 10);
+        verifyMercatorTile(testSource, 2 << 9 - 1, 2 << 8 - 1, 10);
 
         assertEquals("TileXMax", 1, testSource.getTileXMax(1));
@@ -69,5 +69,4 @@
         assertEquals("TileXMax", 5, testSource.getTileXMax(3));
         assertEquals("TileYMax", 4, testSource.getTileYMax(3));
-
     }
 
@@ -87,16 +86,16 @@
         verifyMercatorTile(testSource, 0, 0, 2, zoomOffset);
         verifyMercatorTile(testSource, 1, 1, 2, zoomOffset);
-        for(int x = 0; x < 4; x++) {
-            for(int y = 0; y < 4; y++) {
+        for (int x = 0; x < 4; x++) {
+            for (int y = 0; y < 4; y++) {
                 verifyMercatorTile(testSource, x, y, 3, zoomOffset);
             }
         }
-        for(int x = 0; x < 8; x++) {
-            for(int y = 0; y < 4; y++) {
+        for (int x = 0; x < 8; x++) {
+            for (int y = 0; y < 4; y++) {
                 verifyMercatorTile(testSource, x, y, zoomOffset);
             }
         }
 
-        verifyMercatorTile(testSource, 2<<9 - 1, 2<<8 - 1, zoomOffset);
+        verifyMercatorTile(testSource, 2 << 9 - 1, 2 << 8 - 1, zoomOffset);
 
         assertEquals("TileXMax", 1, testSource.getTileXMax(1));
@@ -106,5 +105,4 @@
         assertEquals("TileXMax", 4, testSource.getTileXMax(3));
         assertEquals("TileYMax", 4, testSource.getTileYMax(3));
-
     }
 
@@ -113,6 +111,6 @@
         Main.setProjection(Projections.getProjectionByCode("EPSG:4326"));
         WMTSTileSource testSource = new WMTSTileSource(testImageryTOPO_PL);
-        verifyTile(new LatLon(56,12), testSource, 0, 0, 1);
-        verifyTile(new LatLon(56,12), testSource, 0, 0, 2);
+        verifyTile(new LatLon(56, 12), testSource, 0, 0, 1);
+        verifyTile(new LatLon(56, 12), testSource, 0, 0, 2);
         verifyTile(new LatLon(51.1268639, 16.8731360), testSource, 1, 1, 2);
 
