Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31796)
@@ -87,16 +87,16 @@
    */
   public String getDate() {
-    String format = "";
+    StringBuilder format = new StringBuilder("");
     if (Main.pref.getBoolean("iso.dates"))
-      format += "yyyy-MM-dd";
+      format.append("yyyy-MM-dd");
     else
-      format += "dd/MM/yyyy";
+      format.append("dd/MM/yyyy");
     if (Main.pref.getBoolean("mapillary.display-hour", true)) {
       if (Main.pref.getBoolean("mapillary.format-24"))
-        format += " - HH:mm:ss (z)";
+        format.append(" - HH:mm:ss (z)");
       else
-        format += " - h:mm:ss a (z)";
-    }
-    return getDate(format);
+        format.append(" - h:mm:ss a (z)");
+    }
+    return getDate(format.toString());
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31796)
@@ -29,5 +29,5 @@
   private final List<MapillaryAbstractImage> multiSelectedImages;
   /** Listeners of the class. */
-  private CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>();
+  private final CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>();
   /** The bounds of the areas for which the pictures have been downloaded. */
   public CopyOnWriteArrayList<Bounds> bounds;
@@ -177,5 +177,5 @@
    * Repaints mapView object.
    */
-  public synchronized static void dataUpdated() {
+  public static synchronized void dataUpdated() {
     if (Main.main != null)
       Main.map.mapView.repaint();
@@ -312,21 +312,16 @@
     this.multiSelectedImages.clear();
     this.multiSelectedImages.add(image);
-    if (image != null && Main.main != null) {
-      if (image instanceof MapillaryImage) {
-        MapillaryImage mapillaryImage = (MapillaryImage) image;
-        // Downloading thumbnails of surrounding pictures.
-        if (mapillaryImage.next() != null) {
-          CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next());
-          if (mapillaryImage.next().next() != null)
-            CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next()
-                .next());
-        }
-        if (mapillaryImage.previous() != null) {
-          CacheUtils
-              .downloadPicture((MapillaryImage) mapillaryImage.previous());
-          if (mapillaryImage.previous().previous() != null)
-            CacheUtils.downloadPicture((MapillaryImage) mapillaryImage
-                .previous().previous());
-        }
+    if (image != null && Main.main != null && image instanceof MapillaryImage) {
+      MapillaryImage mapillaryImage = (MapillaryImage) image;
+      // Downloading thumbnails of surrounding pictures.
+      if (mapillaryImage.next() != null) {
+        CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next());
+        if (mapillaryImage.next().next() != null)
+          CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next().next());
+      }
+      if (mapillaryImage.previous() != null) {
+        CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous());
+        if (mapillaryImage.previous().previous() != null)
+          CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous().previous());
       }
     }
@@ -396,5 +391,5 @@
    * Sets a new ArrayList object as the used set of images.
    *
-   * @param images
+   * @param images the new image list (previously set images are completely replaced)
    */
   public synchronized void setImages(List<MapillaryAbstractImage> images) {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java	(revision 31796)
@@ -23,4 +23,22 @@
 
   /**
+   * Main constructor of the class MapillaryImage
+   *
+   * @param key
+   *          The unique identifier of the image.
+   * @param lat
+   *          The latitude where it is positioned.
+   * @param lon
+   *          The longitude where it is positioned.
+   * @param ca
+   *          The direction of the images in degrees, meaning 0 north.
+   */
+  public MapillaryImage(String key, double lat, double lon, double ca) {
+    super(lat, lon, ca);
+    this.key = key;
+    this.signs = new ArrayList<>();
+  }
+
+  /**
    * Returns the location where the image was taken.
    *
@@ -39,22 +57,4 @@
   public void setLocation(String location) {
     this.location = location;
-  }
-
-  /**
-   * Main constructor of the class MapillaryImage
-   *
-   * @param key
-   *          The unique identifier of the image.
-   * @param lat
-   *          The latitude where it is positioned.
-   * @param lon
-   *          The longitude where it is positioned.
-   * @param ca
-   *          The direction of the images in degrees, meaning 0 north.
-   */
-  public MapillaryImage(String key, double lat, double lon, double ca) {
-    super(lat, lon, ca);
-    this.key = key;
-    this.signs = new ArrayList<>();
   }
 
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31796)
@@ -119,7 +119,7 @@
       if (Main.map.mapView.getEditLayer() != null)
         Main.map.mapView.getEditLayer().data.addDataSetListener(this);
-      if (MapillaryDownloader.getMode() == MapillaryDownloader.AUTOMATIC)
+      if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Automatic)
         MapillaryDownloader.automaticDownload();
-      if (MapillaryDownloader.getMode() == MapillaryDownloader.SEMIAUTOMATIC)
+      if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Semiautomatic)
         this.mode.zoomChanged();
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31796)
@@ -45,15 +45,15 @@
   public static final String SEPARATOR = System.getProperty("file.separator");
   /** 24x24 icon. */
-  public static ImageIcon ICON24;
+  public static final ImageIcon ICON24 = new ImageProvider("icon24.png").get();
   /** 16x16 icon. */
-  public static ImageIcon ICON16;
+  public static final ImageIcon ICON16 = new ImageProvider("icon16.png").get();
   /** Icon representing an image in the map. */
-  public static ImageIcon MAP_ICON;
+  public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png").get();
   /** Icon representing a selected image in the map. */
-  public static ImageIcon MAP_ICON_SELECTED;
+  public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get();
   /** Icon representing an imported image in the map. */
-  public static ImageIcon MAP_ICON_IMPORTED;
+  public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get();
   /** Icon used to identify which images have signs on them */
-  public static ImageIcon MAP_SIGN;
+  public static final ImageIcon MAP_SIGN = new ImageProvider("sign.png").get();
 
   /** Cache that stores the pictures the downloaded pictures. */
@@ -102,11 +102,4 @@
     super(info);
 
-    ICON24 = new ImageProvider("icon24.png").get();
-    ICON16 = new ImageProvider("icon16.png").get();
-    MAP_ICON = new ImageProvider("mapicon.png").get();
-    MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get();
-    MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get();
-    MAP_SIGN = new ImageProvider("sign.png").get();
-
     this.downloadAction = new MapillaryDownloadAction();
     walkAction = new MapillaryWalkAction();
@@ -167,5 +160,5 @@
       Main.map.addToggleDialog(MapillaryFilterDialog.getInstance(), false);
       setMenuEnabled(DOWNLOAD_MENU, true);
-      if (MapillaryDownloader.getMode() == MapillaryDownloader.MANUAL)
+      if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Manual)
         setMenuEnabled(DOWNLOAD_VIEW_MENU, true);
       setMenuEnabled(IMPORT_MENU, true);
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java	(revision 31796)
@@ -36,6 +36,9 @@
   private JCheckBox reverseButtons = new JCheckBox(
       tr("Reverse buttons position when displaying images."));
-  private JComboBox<String> downloadMode = new JComboBox<>(
-      MapillaryDownloader.MODES);
+  private JComboBox<String> downloadMode = new JComboBox<>(new String[]{
+      MapillaryDownloader.MODES.Automatic.toString(),
+      MapillaryDownloader.MODES.Semiautomatic.toString(),
+      MapillaryDownloader.MODES.Manual.toString()
+  });
   private JCheckBox displayHour = new JCheckBox(
       tr("Display hour when the picture was taken"));
@@ -63,13 +66,9 @@
     panel.add(this.reverseButtons);
     // Sets the value of the ComboBox.
-    if (Main.pref.get("mapillary.download-mode").equals(
-        MapillaryDownloader.MODES[0]))
-      this.downloadMode.setSelectedItem(MapillaryDownloader.MODES[0]);
-    if (Main.pref.get("mapillary.download-mode").equals(
-        MapillaryDownloader.MODES[1]))
-      this.downloadMode.setSelectedItem(MapillaryDownloader.MODES[1]);
-    if (Main.pref.get("mapillary.download-mode").equals(
-        MapillaryDownloader.MODES[2]))
-      this.downloadMode.setSelectedItem(MapillaryDownloader.MODES[2]);
+    if (Main.pref.get("mapillary.download-mode").equals(MapillaryDownloader.MODES.Automatic.toString())
+        || Main.pref.get("mapillary.download-mode").equals(MapillaryDownloader.MODES.Semiautomatic.toString())
+        || Main.pref.get("mapillary.download-mode").equals(MapillaryDownloader.MODES.Manual.toString())) {
+      this.downloadMode.setSelectedItem(Main.pref.get("mapillary.download-mode"));
+    }
     JPanel downloadModePanel = new JPanel();
     downloadModePanel.add(new JLabel(tr("Download mode: ")));
@@ -101,13 +100,10 @@
 
     MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, false);
-    if (this.downloadMode.getSelectedItem()
-        .equals(MapillaryDownloader.MODES[0]))
-      Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES[0]);
-    if (this.downloadMode.getSelectedItem()
-        .equals(MapillaryDownloader.MODES[1]))
-      Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES[1]);
-    if (this.downloadMode.getSelectedItem()
-        .equals(MapillaryDownloader.MODES[2])) {
-      Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES[2]);
+    if (this.downloadMode.getSelectedItem().equals(MapillaryDownloader.MODES.Automatic.toString()))
+      Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES.Automatic.toString());
+    if (this.downloadMode.getSelectedItem().equals(MapillaryDownloader.MODES.Semiautomatic.toString()))
+      Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES.Semiautomatic.toString());
+    if (this.downloadMode.getSelectedItem().equals(MapillaryDownloader.MODES.Manual.toString())) {
+      Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES.Manual.toString());
       MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, true);
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 31796)
@@ -29,12 +29,5 @@
 
   /** Possible download modes. */
-  public static final String[] MODES = new String[] { "Automatic",
-      "Semiautomatic", "Manual" };
-  /** Automatic mode. */
-  public static final int AUTOMATIC = 0;
-  /** Semiautomatic mode. */
-  public static final int SEMIAUTOMATIC = 1;
-  /** Manual mode. */
-  public static final int MANUAL = 2;
+  public enum MODES {Automatic, Semiautomatic, Manual};
 
   /** All the Threads that have been run. Used to interrupt them properly. */
@@ -80,5 +73,5 @@
    */
   public static void completeView() {
-    if (getMode() != SEMIAUTOMATIC && getMode() != MANUAL)
+    if (getMode() != MODES.Semiautomatic && getMode() != MODES.Manual)
       throw new IllegalStateException("Must be in semiautomatic or manual mode");
     Bounds view = Main.map.mapView.getRealBounds();
@@ -151,5 +144,5 @@
       return;
     }
-    if (getMode() != AUTOMATIC)
+    if (getMode() != MODES.Automatic)
       throw new IllegalStateException("Must be in automatic mode.");
     for (Bounds bounds : Main.map.mapView.getEditLayer().data
@@ -184,15 +177,15 @@
    * @return 0 - automatic; 1 - semiautomatic; 2 - manual.
    */
-  public static int getMode() {
-    if (Main.pref.get("mapillary.download-mode").equals(MODES[0])
+  public static MapillaryDownloader.MODES getMode() {
+    if (Main.pref.get("mapillary.download-mode").equals(MODES.Automatic.toString())
         && (MapillaryLayer.INSTANCE == null || !MapillaryLayer.INSTANCE.TEMP_SEMIAUTOMATIC))
-      return 0;
-    else if (Main.pref.get("mapillary.download-mode").equals(MODES[1])
+      return MODES.Automatic;
+    else if (Main.pref.get("mapillary.download-mode").equals(MODES.Semiautomatic.toString())
         || (MapillaryLayer.INSTANCE != null && MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC))
-      return 1;
-    else if (Main.pref.get("mapillary.download-mode").equals(MODES[2]))
-      return 2;
+      return MODES.Semiautomatic;
+    else if (Main.pref.get("mapillary.download-mode").equals(MODES.Manual.toString()))
+      return MODES.Manual;
     else if (Main.pref.get("mapillary.download-mode").equals(""))
-      return 0;
+      return MODES.Automatic;
     else
       throw new IllegalStateException();
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java	(revision 31796)
@@ -66,5 +66,5 @@
   @Override
   public void zoomChanged() {
-    if (MapillaryDownloader.getMode() == MapillaryDownloader.SEMIAUTOMATIC) {
+    if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Semiautomatic) {
       if (!semiautomaticThread.isAlive())
         semiautomaticThread.start();
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthPortListener.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthPortListener.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthPortListener.java	(revision 31796)
@@ -24,5 +24,5 @@
 public class OAuthPortListener extends Thread {
 
-  protected static String RESPONSE = tr("<html><head><title>Mapillary login</title></head><body>Login successful, return to JOSM.</body></html>");
+  protected static final String RESPONSE = tr("<html><head><title>Mapillary login</title></head><body>Login successful, return to JOSM.</body></html>");
 
   @Override
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java	(revision 31795)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java	(revision 31796)
@@ -38,5 +38,5 @@
 
     try (
-      BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))
+      BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"))
     ) {
       return Json.createReader(in).readObject();
