Index: trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 2052)
+++ trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 2053)
@@ -119,4 +119,8 @@
     }
 
+    public File getPreferenceFile() {
+        return new File(getPreferencesDirFile(), "preferences");
+    }
+
     public File getPluginsDirFile() {
         return new File(getPreferencesDirFile(), "plugins");
@@ -254,5 +258,9 @@
                 properties.put(key, value);
             }
-            save();
+            try {
+                save();
+            } catch(IOException e){
+                System.out.println(tr("Warning: failed to persist preferences to ''{0}''", getPreferenceFile().getAbsoluteFile()));
+            }
             firePreferenceChanged(key, value);
             return true;
@@ -287,34 +295,30 @@
      * in log.
      */
-    public void save() {
+    public void save() throws IOException {
         /* currently unused, but may help to fix configuration issues in future */
         properties.put("josm.version", AboutAction.getVersionString());
-        try {
-            setSystemProperties();
-            String prefFile = getPreferencesDir() + "preferences";
-
-            // Backup old preferences
-            copyFile(new File(prefFile), new File(prefFile + "_backup"));
-
-            final PrintWriter out = new PrintWriter(new OutputStreamWriter(
-                    new FileOutputStream(prefFile + "_tmp"), "utf-8"), false);
-            for (final Entry<String, String> e : properties.entrySet()) {
-                String s = defaults.get(e.getKey());
-                /* don't save default values */
-                if(s == null || !s.equals(e.getValue())) {
-                    out.println(e.getKey() + "=" + e.getValue());
-                }
-            }
-            out.close();
-
-            File tmpFile = new File(prefFile + "_tmp");
-            copyFile(tmpFile, new File(prefFile));
-            tmpFile.delete();
-
-        } catch (final IOException e) {
-            e.printStackTrace();
-            // do not message anything, since this can be called from strange
-            // places.
-        }
+
+        setSystemProperties();
+        File prefFile = new File(getPreferencesDirFile(), "preferences");
+
+        // Backup old preferences if there are old preferences
+        if(prefFile.exists()) {
+            copyFile(prefFile, new File(prefFile + "_backup"));
+        }
+
+        final PrintWriter out = new PrintWriter(new OutputStreamWriter(
+                new FileOutputStream(prefFile + "_tmp"), "utf-8"), false);
+        for (final Entry<String, String> e : properties.entrySet()) {
+            String s = defaults.get(e.getKey());
+            /* don't save default values */
+            if(s == null || !s.equals(e.getValue())) {
+                out.println(e.getKey() + "=" + e.getValue());
+            }
+        }
+        out.close();
+
+        File tmpFile = new File(prefFile + "_tmp");
+        copyFile(tmpFile, prefFile);
+        tmpFile.delete();
     }
 
@@ -366,13 +370,13 @@
     }
 
-    public void init(Boolean reset)
-    {
+    public void init(boolean reset){
         // get the preferences.
         File prefDir = getPreferencesDirFile();
         if (prefDir.exists()) {
             if(!prefDir.isDirectory()) {
+                System.err.println(tr("Warning: Failed to initialize preferences. Preference directory ''{0}'' isn't a directory.", prefDir.getAbsoluteFile()));
                 JOptionPane.showMessageDialog(
                         Main.parent,
-                        tr("Cannot open preferences directory: {0}",Main.pref.getPreferencesDir()),
+                        tr("<html>Failed to initialize preferences.<br>Preference directory ''{0}'' isn't a directory.</html>", prefDir.getAbsoluteFile()),
                         tr("Error"),
                         JOptionPane.ERROR_MESSAGE
@@ -381,32 +385,60 @@
             }
         } else {
-            prefDir.mkdirs();
-        }
-
-        if (!new File(getPreferencesDir()+"preferences").exists()) {
-            resetToDefault();
-        }
-
+            if (! prefDir.mkdirs()) {
+                System.err.println(tr("Warning: Failed to initialize preferences. Failed to create missing preference directory: {0}", prefDir.getAbsoluteFile()));
+                JOptionPane.showMessageDialog(
+                        Main.parent,
+                        tr("<html>Failed to initialize preferences.<br>Failed to create missing preference directory: {0}</html>",prefDir.getAbsoluteFile()),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE
+                );
+                return;
+            }
+        }
+
+        File preferenceFile = getPreferenceFile();
         try {
-            if (reset) {
+            if (!preferenceFile.exists()) {
+                System.out.println(tr("Warning: Missing preference file ''{0}''. Creating a default preference file.", preferenceFile.getAbsoluteFile()));
                 resetToDefault();
-            } else {
-                load();
-            }
-        } catch (final IOException e1) {
-            e1.printStackTrace();
-            String backup = getPreferencesDir() + "preferences.bak";
+                save();
+            } else if (reset) {
+                System.out.println(tr("Warning: Replacing existing preference file ''{0}'' with default preference file.", preferenceFile.getAbsoluteFile()));
+                resetToDefault();
+                save();
+            }
+        } catch(IOException e) {
+            e.printStackTrace();
             JOptionPane.showMessageDialog(
                     Main.parent,
-                    tr("Preferences file had errors. Making backup of old one to {0}.", backup),
+                    tr("<html>Failed to initialize preferences.<br>Failed to reset preference file to default: {0}</html>",getPreferenceFile().getAbsoluteFile()),
                     tr("Error"),
                     JOptionPane.ERROR_MESSAGE
             );
-            new File(getPreferencesDir() + "preferences").renameTo(new File(backup));
-            save();
-        }
-    }
-
-    public final void resetToDefault() {
+            return;
+        }
+        try {
+            load();
+        } catch (IOException e) {
+            e.printStackTrace();
+            File backupFile = new File(prefDir,"preferences.bak");
+            JOptionPane.showMessageDialog(
+                    Main.parent,
+                    tr("<html>Preferences file had errors.<br> Making backup of old one to <br>{0}<br> and creating a new default preference file.</html>", backupFile.getAbsoluteFile()),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
+            preferenceFile.renameTo(backupFile);
+            try {
+                resetToDefault();
+                save();
+            } catch(IOException e1) {
+                e1.printStackTrace();
+                System.err.println(tr("Warning: Failed to initialize preferences.Failed to reset preference file to default: {0}", getPreferenceFile()));
+            }
+        }
+    }
+
+    public final void resetToDefault(){
         properties.clear();
         put("layerlist.visible", true);
@@ -419,9 +451,12 @@
             put("laf", "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
         }
-        save();
+    }
+
+    public File getBookmarksFile() {
+        return new File(getPreferencesDir(),"bookmarks");
     }
 
     public Collection<Bookmark> loadBookmarks() throws IOException {
-        File bookmarkFile = new File(getPreferencesDir()+"bookmarks");
+        File bookmarkFile = getBookmarksFile();
         if (!bookmarkFile.exists()) {
             bookmarkFile.createNewFile();
Index: trunk/src/org/openstreetmap/josm/gui/BookmarkList.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 2052)
+++ trunk/src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 2053)
@@ -14,4 +14,6 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Preferences;
+
+import sun.security.action.GetBooleanAction;
 
 /**
@@ -44,5 +46,8 @@
             JOptionPane.showMessageDialog(
                     Main.parent,
-                    tr("<html>Could not read bookmarks.<br>{0}</html>", e.getMessage()),
+                    tr("<html>Could not read bookmarks from<br>''{0}''<br>Error was: {1}</html>",
+                            Main.pref.getBookmarksFile(),
+                            e.getMessage()
+                    ),
                     tr("Error"),
                     JOptionPane.ERROR_MESSAGE
Index: trunk/src/org/openstreetmap/josm/gui/MainApplet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 2052)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 2053)
@@ -10,4 +10,5 @@
 import java.awt.event.KeyEvent;
 import java.io.File;
+import java.io.IOException;
 import java.net.URL;
 import java.util.Arrays;
@@ -36,5 +37,5 @@
         public UploadPreferencesAction() {
             super(tr("Upload Preferences"), "upload-preferences", tr("Upload the current preferences to the server"),
-            Shortcut.registerShortcut("applet:uploadprefs", tr("Upload Preferences"), KeyEvent.VK_U, Shortcut.GROUP_HOTKEY), true);
+                    Shortcut.registerShortcut("applet:uploadprefs", tr("Upload Preferences"), KeyEvent.VK_U, Shortcut.GROUP_HOTKEY), true);
         }
         public void actionPerformed(ActionEvent e) {
@@ -70,6 +71,7 @@
         for (String[] s : paramInfo) {
             Collection<String> p = readParameter(s[0], args.get(s[0]));
-            if (p != null)
+            if (p != null) {
                 args.put(s[0], p);
+            }
         }
         if (!args.containsKey("geometry") && getParameter("width") != null && getParameter("height") != null) {
@@ -98,5 +100,4 @@
         Main.pref = new ServerSidePreferences(getCodeBase());
         ((ServerSidePreferences)Main.pref).download(username, password);
-
         Main.preConstructorInit(args);
         Main.parent = this;
@@ -124,6 +125,7 @@
         String param = getParameter(s);
         if (param != null) {
-            if (v == null)
+            if (v == null) {
                 v = new LinkedList<String>();
+            }
             v.addAll(Arrays.asList(param.split(";")));
         }
