Changeset 3877 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-02-09T12:35:03+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
r3695 r3877 61 61 } 62 62 } else { 63 file = checkLocal(url, destDir, maxTime); 63 if(Main.applet) { 64 URLConnection conn = url.openConnection(); 65 conn.setConnectTimeout(5000); 66 conn.setReadTimeout(5000); 67 fs = new BufferedInputStream(conn.getInputStream()); 68 file = new File(url.getFile()); 69 } else { 70 file = checkLocal(url, destDir, maxTime); 71 } 64 72 } 65 73 } catch (java.net.MalformedURLException e) { … … 178 186 String[] lp = localPath.split(";"); 179 187 file = new File(lp[1]); 180 if (maxTime <= 0) { 181 maxTime = Main.pref.getInteger("mirror.maxtime", 7*24*60*60); 182 } 183 if (System.currentTimeMillis() - Long.parseLong(lp[0]) < maxTime*1000) { 184 if(file.exists()) 188 if(!file.exists()) 189 file = null; 190 else { 191 if (maxTime <= 0) { 192 maxTime = Main.pref.getInteger("mirror.maxtime", 7*24*60*60); 193 } 194 if (System.currentTimeMillis() - Long.parseLong(lp[0]) < maxTime*1000) { 185 195 return file; 196 } 186 197 } 187 198 } … … 211 222 bos.write(buffer, 0, length); 212 223 } 224 bos.close(); 225 bos = null; 226 file = new File(destDir, localPath); 227 destDirFile.renameTo(file); 228 Main.pref.put(prefKey, System.currentTimeMillis() + ";" + file); 213 229 } finally { 214 230 if (bis != null) { … … 226 242 } 227 243 } 228 file = new File(destDir, localPath);229 destDirFile.renameTo(file);230 Main.pref.put(prefKey, System.currentTimeMillis() + ";" + file);231 244 } 232 245
Note:
See TracChangeset
for help on using the changeset viewer.