Index: /trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 8357)
@@ -337,5 +337,5 @@
      * Class that represent a line
      */
-    private class Line {
+    private static class Line {
 
         /**
Index: /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 8357)
@@ -765,7 +765,6 @@
         List<WayInPolygon> result = new ArrayList<>();
 
-        //prepare prev and next maps
+        //prepare next map
         Map<Way, Way> nextWayMap = new HashMap<>();
-        Map<Way, Way> prevWayMap = new HashMap<>();
 
         for (int pos = 0; pos < parts.size(); pos ++) {
@@ -775,5 +774,4 @@
 
             nextWayMap.put(parts.get(pos), parts.get((pos + 1) % parts.size()));
-            prevWayMap.put(parts.get(pos), parts.get((pos + parts.size() - 1) % parts.size()));
         }
 
Index: /trunk/src/org/openstreetmap/josm/actions/RestartAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/RestartAction.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/actions/RestartAction.java	(revision 8357)
@@ -114,8 +114,9 @@
                 String[] mainCommand = System.getProperty("sun.java.command").split(" ");
                 // look for a .jar in all chunks to support paths with spaces (fix #9077)
-                String jarPath = mainCommand[0];
-                for (int i = 1; i < mainCommand.length && !jarPath.endsWith(".jar"); i++) {
-                    jarPath += " " + mainCommand[i];
-                }
+                StringBuilder sb = new StringBuilder(mainCommand[0]);
+                for (int i = 1; i < mainCommand.length && !mainCommand[i-1].endsWith(".jar"); i++) {
+                    sb.append(" ").append(mainCommand[i]);
+                }
+                String jarPath = sb.toString();
                 // program main is a jar
                 if (jarPath.endsWith(".jar")) {
Index: /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 8357)
@@ -197,5 +197,8 @@
                 Main.warn(tr("Unable to delete old backup file {0}", oldFile.getAbsolutePath()));
             } else {
-                getPidFile(oldFile).delete();
+                File pidFile = getPidFile(oldFile);
+                if (!pidFile.delete()) {
+                    Main.warn(tr("Unable to delete old backup file {0}", pidFile.getAbsolutePath()));
+                }
             }
         }
Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 8357)
@@ -815,5 +815,7 @@
         File tmpFile = new File(prefFile + "_tmp");
         Utils.copyFile(tmpFile, prefFile);
-        tmpFile.delete();
+        if (!tmpFile.delete()) {
+            Main.warn(tr("Unable to delete temporary file {0}", tmpFile.getAbsolutePath()));
+        }
 
         setCorrectPermissions(prefFile);
@@ -822,9 +824,19 @@
 
     private void setCorrectPermissions(File file) {
-        file.setReadable(false, false);
-        file.setWritable(false, false);
-        file.setExecutable(false, false);
-        file.setReadable(true, true);
-        file.setWritable(true, true);
+        if (!file.setReadable(false, false) && Main.isDebugEnabled()) {
+            Main.debug(tr("Unable to set file non-readable {0}", file.getAbsolutePath()));
+        }
+        if (!file.setWritable(false, false) && Main.isDebugEnabled()) {
+            Main.debug(tr("Unable to set file non-writable {0}", file.getAbsolutePath()));
+        }
+        if (!file.setExecutable(false, false) && Main.isDebugEnabled()) {
+            Main.debug(tr("Unable to set file non-executable {0}", file.getAbsolutePath()));
+        }
+        if (!file.setReadable(true, true) && Main.isDebugEnabled()) {
+            Main.debug(tr("Unable to set file readable {0}", file.getAbsolutePath()));
+        }
+        if (!file.setWritable(true, true) && Main.isDebugEnabled()) {
+            Main.debug(tr("Unable to set file writable {0}", file.getAbsolutePath()));
+        }
     }
 
Index: /trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java	(revision 8357)
@@ -56,6 +56,7 @@
 
         File cacheDirLockPath = new File(cacheDir, ".lock");
-        if (!cacheDirLockPath.exists())
-            cacheDirLockPath.createNewFile();
+        if (!cacheDirLockPath.exists() && !cacheDirLockPath.createNewFile()) {
+            log.log(Level.WARNING, "Cannot create cache dir lock file");
+        }
         cacheDirLock = new FileOutputStream(cacheDirLockPath).getChannel().tryLock();
 
Index: /trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java	(revision 8357)
@@ -9,17 +9,28 @@
  *
  * This class is convenient to use, but has relatively high memory costs.
- * It keeps a pointer to the last known projection in order to detect projection
- * changes.
+ * It keeps a pointer to the last known projection in order to detect projection changes.
  *
  * Node and WayPoint have another, optimized, cache for projected coordinates.
  */
 public class CachedLatLon extends LatLon {
+
+    private static final long serialVersionUID = 1L;
+
     private EastNorth eastNorth;
     private transient Projection proj;
 
+    /**
+     * Constructs a new {@code CachedLatLon}.
+     * @param lat latitude
+     * @param lon longitude
+     */
     public CachedLatLon(double lat, double lon) {
         super(lat, lon);
     }
 
+    /**
+     * Constructs a new {@code CachedLatLon}.
+     * @param coor lat/lon
+     */
     public CachedLatLon(LatLon coor) {
         super(coor.lat(), coor.lon());
@@ -27,4 +38,8 @@
     }
 
+    /**
+     * Constructs a new {@code CachedLatLon}.
+     * @param eastNorth easting/northing
+     */
     public CachedLatLon(EastNorth eastNorth) {
         super(Main.getProjection().eastNorth2latlon(eastNorth));
@@ -39,6 +54,5 @@
      */
     public final EastNorth getEastNorth() {
-        if(proj != Main.getProjection())
-        {
+        if (proj != Main.getProjection()) {
             proj = Main.getProjection();
             eastNorth = proj.latlon2eastNorth(this);
@@ -46,11 +60,8 @@
         return eastNorth;
     }
-    @Override public String toString() {
+
+    @Override
+    public String toString() {
         return "CachedLatLon[lat="+lat()+",lon="+lon()+"]";
     }
-
-    // Only for Node.get3892DebugInfo()
-    public Projection getProjection() {
-        return proj;
-    }
 }
Index: /trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java	(revision 8356)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java	(revision 8357)
@@ -112,5 +112,7 @@
     public WmsCache(String url, int tileSize) {
         File globalCacheDir = new File(cacheDirPath());
-        globalCacheDir.mkdirs();
+        if (!globalCacheDir.mkdirs()) {
+            Main.warn("Unable to create global cache directory: "+globalCacheDir.getAbsolutePath());
+        }
         cacheDir = new File(globalCacheDir, getCacheDirectory(url));
         cacheDir.mkdirs();
@@ -230,6 +232,6 @@
                 if (files != null) {
                     for (File file: files) {
-                        if (!referencedFiles.contains(file.getName())) {
-                            file.delete();
+                        if (!referencedFiles.contains(file.getName()) && !file.delete()) {
+                            Main.warn("Unable to delete file: "+file.getAbsolutePath());
                         }
                     }
@@ -530,5 +532,7 @@
         }
 
-        imageFile.getParentFile().mkdirs();
+        if (!imageFile.getParentFile().mkdirs()) {
+            Main.warn("Unable to create parent directory: "+imageFile.getParentFile().getAbsolutePath());
+        }
 
         if (img != null) {
@@ -555,5 +559,7 @@
                     }
                     totalFileSize -= size;
-                    file.delete();
+                    if (!file.delete()) {
+                        Main.warn("Unable to delete file: "+file.getAbsolutePath());
+                    }
                     it.remove();
                 }
