Index: trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 3876)
+++ trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 3877)
@@ -61,5 +61,13 @@
                 }
             } else {
-                file = checkLocal(url, destDir, maxTime);
+                if(Main.applet) {
+                    URLConnection conn = url.openConnection();
+                    conn.setConnectTimeout(5000);
+                    conn.setReadTimeout(5000);
+                    fs = new BufferedInputStream(conn.getInputStream());
+                    file = new File(url.getFile());
+                } else {
+                    file = checkLocal(url, destDir, maxTime);
+                }
             }
         } catch (java.net.MalformedURLException e) {
@@ -178,10 +186,13 @@
             String[] lp = localPath.split(";");
             file = new File(lp[1]);
-            if (maxTime <= 0) {
-                maxTime = Main.pref.getInteger("mirror.maxtime", 7*24*60*60);
-            }
-            if (System.currentTimeMillis() - Long.parseLong(lp[0]) < maxTime*1000) {
-                if(file.exists())
+            if(!file.exists())
+                file = null;
+            else {
+                if (maxTime <= 0) {
+                    maxTime = Main.pref.getInteger("mirror.maxtime", 7*24*60*60);
+                }
+                if (System.currentTimeMillis() - Long.parseLong(lp[0]) < maxTime*1000) {
                     return file;
+                }
             }
         }
@@ -211,4 +222,9 @@
                 bos.write(buffer, 0, length);
             }
+            bos.close();
+            bos = null;
+            file = new File(destDir, localPath);
+            destDirFile.renameTo(file);
+            Main.pref.put(prefKey, System.currentTimeMillis() + ";" + file);
         } finally {
             if (bis != null) {
@@ -226,7 +242,4 @@
                 }
             }
-            file = new File(destDir, localPath);
-            destDirFile.renameTo(file);
-            Main.pref.put(prefKey, System.currentTimeMillis() + ";" + file);
         }
 
