Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java	(revision 33047)
@@ -199,4 +199,15 @@
         super(info);
         Main.info("Pluging cadastre-fr v"+VERSION+" started...");
+        initCacheDir();
+
+        refreshConfiguration();
+
+        UploadAction.registerUploadHook(new CheckSourceUploadHook());
+
+        registerSessionLayerExporter(WMSLayer.class, CadastreSessionExporter.class);
+        registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class);
+    }
+
+    private static void initCacheDir() {
         if (Main.pref.get("cadastrewms.cacheDir").isEmpty()) {
             cacheDir = new File(Main.pref.getCacheDirectory(), "cadastrewms").getAbsolutePath();
@@ -207,11 +218,4 @@
             cacheDir += File.separatorChar;
         Main.info("current cache directory: "+cacheDir);
-
-        refreshConfiguration();
-
-        UploadAction.registerUploadHook(new CheckSourceUploadHook());
-
-        registerSessionLayerExporter(WMSLayer.class, CadastreSessionExporter.class);
-        registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class);
     }
 
@@ -357,5 +361,5 @@
             JMenuItem item = cadastreJMenu.getItem(i);
             if (item != null)
-                if (item.getText().equals(MenuActionGrabPlanImage.name) /*||
+                if (item.getText().equals(MenuActionGrabPlanImage.NAME) /*||
                     item.getText().equals(MenuActionGrab.name) ||
                     item.getText().equals(MenuActionBoundaries.name) ||
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java	(revision 33047)
@@ -203,5 +203,5 @@
                 file.delete();
             try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file, true));
-                 InputStreamReader isr = new InputStreamReader(is);
+                 InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
                  BufferedReader br = new BufferedReader(isr)) {
                 String line;
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionBoundaries.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionBoundaries.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionBoundaries.java	(revision 33047)
@@ -12,12 +12,15 @@
 
 public class MenuActionBoundaries extends JosmAction {
-    
-    public static String name = "Administrative boundary";
+
+    public static final String NAME = "Administrative boundary";
 
     private static final long serialVersionUID = 1L;
     private WMSLayer wmsLayer = null;
-   
+
+    /**
+     * Constructs a new {@code MenuActionBoundaries}.
+     */
     public MenuActionBoundaries() {
-        super(tr(name), "cadastre_small", tr("Extract commune boundary"), null, false);
+        super(tr(NAME), "cadastre_small", tr("Extract commune boundary"), null, false);
     }
 
@@ -35,4 +38,3 @@
         }
     }
-
 }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionCancelGrab.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionCancelGrab.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionCancelGrab.java	(revision 33047)
@@ -12,10 +12,14 @@
 public class MenuActionCancelGrab extends JosmAction {
 
-    public static String name = marktr("Cancel current grab");
+    public static final String NAME = marktr("Cancel current grab");
 
     private WMSLayer wmsLayer;
-    
+
+    /**
+     * Constructs a new {@code MenuActionCancelGrab}.
+     * @param wmsLayer WMS layer
+     */
     public MenuActionCancelGrab(WMSLayer wmsLayer) {
-        super(tr(name), null, tr("Cancel current grab (only vector images)"), null, false);
+        super(tr(NAME), null, tr("Cancel current grab (only vector images)"), null, false);
         this.wmsLayer = wmsLayer;
     }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java	(revision 33047)
@@ -17,8 +17,11 @@
 public class MenuActionGrab extends JosmAction {
 
-    public static String name = marktr("Cadastre grab");
+    public static final String NAME = marktr("Cadastre grab");
 
+    /**
+     * Constructs a new {@code MenuActionGrab}.
+     */
     public MenuActionGrab() {
-        super(tr(name), "cadastre_small", tr("Download Image from French Cadastre WMS"),
+        super(tr(NAME), "cadastre_small", tr("Download Image from French Cadastre WMS"),
                 Shortcut.registerShortcut("cadastre:grab", tr("Cadastre: {0}", tr("Download Image from French Cadastre WMS")),
                 KeyEvent.VK_F10, Shortcut.DIRECT), false, "cadastrefr/grab", true);
@@ -38,4 +41,3 @@
             new MenuActionNewLocation().actionPerformed(e);
     }
-
 }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 33047)
@@ -20,5 +20,5 @@
     private static final long serialVersionUID = 1L;
 
-    public static String name = marktr("Georeference an image");
+    public static final String NAME = marktr("Georeference an image");
 
     private DownloadWMSPlanImage downloadWMSPlanImage;
@@ -26,6 +26,9 @@
     private RasterImageGeoreferencer rasterImageGeoreferencer;
 
+    /**
+     * Constructs a new {@code MenuActionGrabPlanImage}.
+     */
     public MenuActionGrabPlanImage() {
-        super(tr(name), "cadastre_small", tr("Grab non-georeferenced image"), null, false, "cadastrefr/grabplanimage", true);
+        super(tr(NAME), "cadastre_small", tr("Grab non-georeferenced image"), null, false, "cadastrefr/grabplanimage", true);
         rasterImageGeoreferencer = new RasterImageGeoreferencer();
     }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionOpenPreferences.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionOpenPreferences.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionOpenPreferences.java	(revision 33047)
@@ -14,8 +14,11 @@
     private static final long serialVersionUID = 1L;
 
-    public static String name = marktr("Preferences");
+    public static final String NAME = marktr("Preferences");
 
+    /**
+     * Constructs a new {@code MenuActionOpenPreferences}.
+     */
     public MenuActionOpenPreferences() {
-        super(tr(name), "cadastre_small", tr("Open Cadastre Preferences"), null, false, "cadastrefr/openpreferences", true);
+        super(tr(NAME), "cadastre_small", tr("Open Cadastre Preferences"), null, false, "cadastrefr/openpreferences", true);
     }
 
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionRefineGeoRef.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionRefineGeoRef.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionRefineGeoRef.java	(revision 33047)
@@ -12,11 +12,15 @@
 public class MenuActionRefineGeoRef extends JosmAction {
 
-    public static String name = marktr("Refine georeferencing");
+    public static final String NAME = marktr("Refine georeferencing");
 
     private WMSLayer wmsLayer;
     private RasterImageGeoreferencer rasterImageGeoreferencer;
 
+    /**
+     * Constructs a new {@code MenuActionRefineGeoRef}.
+     * @param wmsLayer WMS layer
+     */
     public MenuActionRefineGeoRef(WMSLayer wmsLayer) {
-        super(tr(name), null, tr("Improve georeferencing (only raster images)"), null, false);
+        super(tr(NAME), null, tr("Improve georeferencing (only raster images)"), null, false);
         this.wmsLayer = wmsLayer;
         rasterImageGeoreferencer = new RasterImageGeoreferencer();
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionSaveRasterAs.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionSaveRasterAs.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionSaveRasterAs.java	(revision 33047)
@@ -9,4 +9,5 @@
 import java.io.File;
 import java.io.IOException;
+import java.util.Locale;
 
 import javax.imageio.ImageIO;
@@ -29,5 +30,5 @@
 public class MenuActionSaveRasterAs extends JosmAction {
 
-    public static String name = marktr("Save image as...");
+    public static final String NAME = marktr("Save image as...");
 
     private static final long serialVersionUID = 1L;
@@ -41,5 +42,5 @@
                 return true;
             }
-            return file.getName().toLowerCase().endsWith(".png");
+            return file.getName().toLowerCase(Locale.ENGLISH).endsWith(".png");
         }
 
@@ -56,5 +57,5 @@
                 return true;
             }
-            return file.getName().toLowerCase().endsWith(".tif");
+            return file.getName().toLowerCase(Locale.ENGLISH).endsWith(".tif");
         }
 
@@ -68,6 +69,10 @@
     FiltrePng filtrePng = new FiltrePng();
 
+    /**
+     * Constructs a new {@code MenuActionSaveRasterAs}.
+     * @param wmsLayer WMS layer
+     */
     public MenuActionSaveRasterAs(WMSLayer wmsLayer) {
-        super(tr(name), "save", tr("Export image (only raster images)"), null, false);
+        super(tr(NAME), "save", tr("Export image (only raster images)"), null, false);
         this.wmsLayer = wmsLayer;
     }
@@ -126,6 +131,5 @@
                     coverage.dispose(true);
                 } catch (Exception e) {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                    Main.error(e);
                 }
             }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageGeoreferencer.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageGeoreferencer.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/RasterImageGeoreferencer.java	(revision 33047)
@@ -168,7 +168,7 @@
   * around org1/dst1 anchor
   * @param org1 first point at original coordinate system (the grabbed image)
-  * @param org2 second point "
+  * @param org2 second point
   * @param dst1 first point at final destination coordinate system (the real east/north coordinate system)
-  * @param dst2 second point "
+  * @param dst2 second point
   */
  private void affineTransform(EastNorth org1, EastNorth org2, EastNorth dst1, EastNorth dst2) {
@@ -188,10 +188,7 @@
      double dy = dst1.getY() - org1.getY();
      wmsLayer.getImage(0).shear(dx, dy);
-     org1 = org1.add(dx, dy); // org1=dst1 now
-     org2 = org2.add(dx, dy);
-     // rotate : org1(=dst1 now) is anchor for rotation and scale
+     // rotate : dst1 is anchor for rotation and scale
      wmsLayer.getImage(0).rotate(dst1, angle);
-     org2 = org2.rotate(dst1, angle);
-     // scale image from anchor org1(=dst1 now)
+     // scale image from anchor dst1
      wmsLayer.getImage(0).scale(dst1, proportion);
  }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SimplifyWay.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SimplifyWay.java	(revision 33046)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/SimplifyWay.java	(revision 33047)
@@ -7,4 +7,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.projection.Ellipsoid;
 
 /**
@@ -34,5 +35,5 @@
     }
 
-    /*
+    /**
      * Takes an interval [from,to] and adds nodes from (from,to) to ns.
      * (from and to are indices of wnew.nodes.)
@@ -45,5 +46,5 @@
         for (int i = from + 1; i < to; i++) {
             Node n = wnew.getNode(i);
-            double xte = Math.abs(EARTH_RAD
+            double xte = Math.abs(Ellipsoid.WGS84.a
                     * xtd(fromN.getCoor().lat() * Math.PI / 180, fromN.getCoor().lon() * Math.PI / 180, toN.getCoor().lat() * Math.PI
                             / 180, toN.getCoor().lon() * Math.PI / 180, n.getCoor().lat() * Math.PI / 180, n.getCoor().lon() * Math.PI
@@ -61,6 +62,4 @@
         }
     }
-
-    public static double EARTH_RAD = 6378137.0;
 
     /* From Aviaton Formulary v1.3
