Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 4809)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 4810)
@@ -268,4 +268,18 @@
     public File getPluginsDirectory() {
         return new File(getPreferencesDirFile(), "plugins");
+    }
+    
+    public File getCacheDirectory() {
+        File cache = new File(getPreferencesDirFile(), "cache");
+        if (!cache.exists() && !cache.mkdirs()) {
+            System.err.println(tr("Warning: Failed to create missing cache directory: {0}", cache.getAbsoluteFile()));
+            JOptionPane.showMessageDialog(
+                    Main.parent,
+                    tr("<html>Failed to create missing cache directory: {0}</html>",cache.getAbsoluteFile()),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE
+            );
+        }
+        return cache;
     }
 
Index: /trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java	(revision 4809)
+++ /trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java	(revision 4810)
@@ -78,5 +78,5 @@
         this.ident = ident;
         this.updateInterval = updateInterval;
-        this.path = new File(Main.pref.getPreferencesDir(), ident);
+        this.path = new File(Main.pref.getCacheDirectory(), ident);
     }
 
@@ -86,5 +86,5 @@
      */
     public byte[] updateIfRequired() throws T {
-        if(Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000
+        if (Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000
                 || !isCacheValid())
             return updateForce();
@@ -97,5 +97,5 @@
      */
     public String updateIfRequiredString() throws T {
-        if(Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000
+        if (Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000
                 || !isCacheValid())
             return updateForceString();
@@ -121,6 +121,6 @@
         updateForce();
         try {
-            return new String(data,"utf-8");
-        } catch(UnsupportedEncodingException e){
+            return new String(data, "utf-8");
+        } catch (UnsupportedEncodingException e){
             e.printStackTrace();
             return "";
@@ -133,5 +133,5 @@
      */
     public byte[] getData() throws T {
-        if(data == null) {
+        if (data == null) {
             loadFromDisk();
         }
@@ -156,5 +156,5 @@
      */
     private void loadFromDisk() throws T {
-        if(Main.applet)
+        if (Main.applet)
             this.data = updateForce();
         else {
@@ -164,5 +164,5 @@
                 input.read(this.data);
                 input.close();
-            } catch(IOException e) {
+            } catch (IOException e) {
                 this.data = updateForce();
             }
@@ -174,5 +174,5 @@
      */
     private void saveToDisk() {
-        if(Main.applet)
+        if (Main.applet)
             return;
         try {
