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 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31972)
@@ -5,4 +5,5 @@
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 
 import org.openstreetmap.josm.Main;
@@ -118,6 +119,5 @@
   public String getDate(String format) {
     final Date date = new Date(getCapturedAt());
-
-    final SimpleDateFormat formatter = new SimpleDateFormat(format);
+    final SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK);
     formatter.setTimeZone(Calendar.getInstance().getTimeZone());
     return formatter.format(date);
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 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java	(revision 31972)
@@ -22,5 +22,5 @@
 public class MapillaryData {
 
-  private Set<MapillaryAbstractImage> images;
+  private final Set<MapillaryAbstractImage> images;
   /**
    * The image currently selected, this is the one being shown.
@@ -123,8 +123,8 @@
   public void addMultiSelectedImage(MapillaryAbstractImage image) {
     if (!this.multiSelectedImages.contains(image)) {
-      if (this.getSelectedImage() != null)
+      if (this.getSelectedImage() == null)
+        this.setSelectedImage(image);
+      else
         this.multiSelectedImages.add(image);
-      else
-        this.setSelectedImage(image);
     }
     if (Main.main != null)
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 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java	(revision 31972)
@@ -357,9 +357,7 @@
       } else if (imageAbs instanceof MapillaryImportedImage) {
         MapillaryImportedImage image = (MapillaryImportedImage) imageAbs;
-        ImageIcon icon;
-        if (!this.data.getMultiSelectedImages().contains(image))
-          icon = MapillaryPlugin.MAP_ICON_IMPORTED;
-        else
-          icon = MapillaryPlugin.MAP_ICON_SELECTED;
+        ImageIcon icon = this.data.getMultiSelectedImages().contains(image)
+            ? MapillaryPlugin.MAP_ICON_SELECTED
+            : MapillaryPlugin.MAP_ICON_IMPORTED;
         draw(g, image, icon, p);
       }
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 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31972)
@@ -273,8 +273,8 @@
    */
   public static ImageProvider getProvider(String s) {
-    if (Main.main == null)
+    if (Main.main == null) {
       return null;
-    else
-      return new ImageProvider(s);
+    }
+    return new ImageProvider(s);
   }
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/FinishedUploadDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/FinishedUploadDialog.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/FinishedUploadDialog.java	(revision 31972)
@@ -34,5 +34,5 @@
   public FinishedUploadDialog() {
     this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
-    JLabel text = new JLabel(tr("Uploaded {0} images", PluginState.imagesUploaded));
+    JLabel text = new JLabel(tr("Uploaded {0} images", PluginState.getImagesUploaded()));
     text.setAlignmentX(Component.CENTER_ALIGNMENT);
     this.add(text);
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java	(revision 31972)
@@ -284,5 +284,5 @@
   private class UndoRedoSelectionListener implements TreeSelectionListener {
 
-    private JTree source;
+    private final JTree source;
 
     protected UndoRedoSelectionListener(JTree source) {
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java	(revision 31972)
@@ -579,6 +579,7 @@
                 : new GridLayout(1, buttons.size()));
         this.buttonsPanel.add(buttonRowPanel);
-        for (SideButton button : buttons)
+        for (SideButton button : buttons) {
           buttonRowPanel.add(button);
+        }
       }
       panel.add(this.buttonsPanel, BorderLayout.NORTH);
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordListener.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordListener.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordListener.java	(revision 31972)
@@ -13,4 +13,4 @@
    * Fired when any command is undone or redone.
    */
-  public void recordChanged();
+  void recordChanged();
 }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandJoin.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandJoin.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandJoin.java	(revision 31972)
@@ -18,6 +18,6 @@
 public class CommandJoin extends MapillaryExecutableCommand {
 
-  private MapillaryAbstractImage a;
-  private MapillaryAbstractImage b;
+  private final MapillaryAbstractImage a;
+  private final MapillaryAbstractImage b;
 
   /**
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandUnjoin.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandUnjoin.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandUnjoin.java	(revision 31972)
@@ -18,6 +18,6 @@
 public class CommandUnjoin extends MapillaryExecutableCommand {
 
-  private MapillaryAbstractImage a;
-  private MapillaryAbstractImage b;
+  private final MapillaryAbstractImage a;
+  private final MapillaryAbstractImage b;
 
   /**
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 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java	(revision 31972)
@@ -205,5 +205,5 @@
     for (Thread t : threads) {
       if (t.isAlive())
-        System.out.println(t);
+        Main.info(t+" is still alive!");
       t.interrupt();
     }
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 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java	(revision 31972)
@@ -86,5 +86,5 @@
     private long lastDownload;
 
-    private boolean moved = false;
+    private boolean moved;
 
     @Override
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java	(revision 31972)
@@ -37,5 +37,5 @@
   private final MapillaryRecord record;
   private boolean nothingHighlighted;
-  private boolean imageHighlighted = false;
+  private boolean imageHighlighted;
 
   /**
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31972)
@@ -88,5 +88,5 @@
     @Override
     public void run() {
-      PluginState.imagesToUpload(this.images.size());
+      PluginState.addImagesToUpload(this.images.size());
       MapillaryUtils.updateHelpText();
       for (MapillaryAbstractImage img : this.images) {
@@ -194,4 +194,5 @@
     byte[] imageBytes = outputStream.toByteArray();
     new ExifRewriter().updateExifMetadataLossless(imageBytes, os, outputSet);
+    os.close();
     return tempFile;
   }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/traffico/TrafficoGlyph.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/traffico/TrafficoGlyph.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/traffico/TrafficoGlyph.java	(revision 31972)
@@ -11,8 +11,9 @@
 
 public final class TrafficoGlyph {
+  private static Map<String, Character> glyphs;
+
   private TrafficoGlyph() {
     // private constructor to avoid instantiation
   }
-  private static Map<String, Character> glyphs;
 
   private static Map<String, Character> readGlyphsFromResources() {
@@ -25,8 +26,9 @@
       glyphs.put(name, glyphObject.getString(name).charAt(0));
     }
+    reader.close();
     return glyphs;
   }
 
-  public static Character getGlyph(String key) {
+  public static synchronized Character getGlyph(String key) {
     if (glyphs == null) {
       glyphs = readGlyphsFromResources();
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java	(revision 31972)
@@ -125,6 +125,5 @@
    *                                  not one of the values mentioned above
    */
-  public static double degMinSecToDouble(RationalNumber[] degMinSec,
-                                         String ref) {
+  public static double degMinSecToDouble(RationalNumber[] degMinSec, String ref) {
     if (degMinSec == null || degMinSec.length != 3) {
       throw new IllegalArgumentException("Array's length must be 3.");
@@ -256,9 +255,8 @@
                       ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
       if (lat_ref == null || lat == null || lon == null || lon_ref == null) {
-        if (exceptionNoTags)
-          throw new IllegalArgumentException(
-                  "The image doesn't have the needed EXIF tags.");
-        else
-          return readNoTags(file);
+        if (exceptionNoTags) {
+          throw new IllegalArgumentException("The image doesn't have the needed EXIF tags.");
+        }
+        return readNoTags(file);
       }
       double latValue = 0;
@@ -273,9 +271,8 @@
       if (ca != null && ca.getValue() instanceof RationalNumber)
         caValue = ((RationalNumber) ca.getValue()).doubleValue();
-      if (datetimeOriginal != null)
-        return new MapillaryImportedImage(latValue, lonValue, caValue, file,
-                datetimeOriginal.getStringValue());
-      else
-        return new MapillaryImportedImage(latValue, lonValue, caValue, file);
+      if (datetimeOriginal != null) {
+        return new MapillaryImportedImage(latValue, lonValue, caValue, file, datetimeOriginal.getStringValue());
+      }
+      return new MapillaryImportedImage(latValue, lonValue, caValue, file);
     }
     throw new IllegalStateException("Invalid format.");
@@ -317,14 +314,11 @@
               .findEXIFValueWithExactMatch(
                       ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
-      if (datetimeOriginal == null)
-        return new MapillaryImportedImage(pos.lat(), pos.lon(), 0,
-                file);
-      else {
-        try {
-          return new MapillaryImportedImage(pos.lat(), pos.lon(), 0,
-                  file, datetimeOriginal.getStringValue());
-        } catch (ImageReadException e) {
-          Main.error(e);
-        }
+      if (datetimeOriginal == null) {
+        return new MapillaryImportedImage(pos.lat(), pos.lon(), 0, file);
+      }
+      try {
+        return new MapillaryImportedImage(pos.lat(), pos.lon(), 0, file, datetimeOriginal.getStringValue());
+      } catch (ImageReadException e) {
+        Main.error(e);
       }
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/PluginState.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/PluginState.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/PluginState.java	(revision 31972)
@@ -19,7 +19,7 @@
   private static int runningDownloads;
   /** Images that have to be uploaded. */
-  protected static int imagesToUpload;
+  private static int imagesToUpload;
   /** Images that have been uploaded. */
-  public static int imagesUploaded;
+  private static int imagesUploaded;
 
   private PluginState() {
@@ -68,5 +68,5 @@
    *          The amount of images that are going to be uploaded.
    */
-  public static void imagesToUpload(int amount) {
+  public static void addImagesToUpload(int amount) {
     if (imagesToUpload <= imagesUploaded) {
       imagesToUpload = 0;
@@ -74,4 +74,12 @@
     }
     imagesToUpload += amount;
+  }
+
+  public static int getImagesToUpload() {
+    return imagesToUpload;
+  }
+
+  public static int getImagesUploaded() {
+    return imagesUploaded;
   }
 
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java	(revision 31972)
@@ -61,5 +61,5 @@
 
   @Test
-  public void testConnectURL() throws MalformedURLException {
+  public void testConnectURL() {
     assertUrlEquals(
         MapillaryURL.connectURL("http://redirect-host/ä"),
@@ -89,5 +89,5 @@
 
   @Test
-  public void testSearchImageURL() throws MalformedURLException {
+  public void testSearchImageURL() {
     assertUrlEquals(
         MapillaryURL.searchImageURL(new Bounds(1.1, 2.22, 3.333, 4.4444), 42),
@@ -111,5 +111,5 @@
 
   @Test
-  public void testSearchSequenceURL() throws MalformedURLException {
+  public void testSearchSequenceURL() {
     assertUrlEquals(
         MapillaryURL.searchSequenceURL(new Bounds(-55.55555, -66.666666, 77.7777777, 88.88888888, false), 42),
@@ -133,5 +133,5 @@
 
   @Test
-  public void testSearchTrafficSignURL() throws MalformedURLException {
+  public void testSearchTrafficSignURL() {
     assertUrlEquals(
         MapillaryURL.searchTrafficSignURL(new Bounds(1.1, 2.22, 3.333, 4.4444), -42),
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/PluginStateTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/PluginStateTest.java	(revision 31971)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/PluginStateTest.java	(revision 31972)
@@ -35,15 +35,15 @@
   public void uploadTest() {
     assertEquals(false, PluginState.isUploading());
-    PluginState.imagesToUpload(2);
-    assertEquals(2, PluginState.imagesToUpload);
-    assertEquals(0, PluginState.imagesUploaded);
+    PluginState.addImagesToUpload(2);
+    assertEquals(2, PluginState.getImagesToUpload());
+    assertEquals(0, PluginState.getImagesUploaded());
     assertEquals(true, PluginState.isUploading());
     PluginState.imageUploaded();
-    assertEquals(1, PluginState.imagesUploaded);
+    assertEquals(1, PluginState.getImagesUploaded());
     assertEquals(true, PluginState.isUploading());
     PluginState.imageUploaded();
     assertEquals(false, PluginState.isUploading());
-    assertEquals(2, PluginState.imagesToUpload);
-    assertEquals(2, PluginState.imagesUploaded);
+    assertEquals(2, PluginState.getImagesToUpload());
+    assertEquals(2, PluginState.getImagesUploaded());
   }
 }
