Changeset 4022 in josm
- Timestamp:
- 2011-04-14T18:11:06+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
r3877 r4022 13 13 import java.net.URL; 14 14 import java.net.URLConnection; 15 import java.util.Arrays; 16 import java.util.Collection; 15 17 import java.util.Enumeration; 16 18 import java.util.zip.ZipEntry; … … 146 148 { 147 149 String prefKey = getPrefKey(url, destDir); 148 String localPath = Main.pref.get(prefKey);149 if (localPath != null && localPath.length() > 0)150 {151 String[] lp = localPath.split(";");150 // FIXME: replace with normal getCollection after july 2011 151 Collection<String> localPath = Main.pref.getCollectionOld(prefKey, ";"); 152 if(localPath.size() == 2) { 153 String[] lp = (String[]) localPath.toArray(); 152 154 File lfile = new File(lp[1]); 153 155 if(lfile.exists()) { … … 176 178 } 177 179 prefKey.append(url.toString()); 178 return prefKey.toString() ;180 return prefKey.toString().replaceAll("=","_"); 179 181 } 180 182 181 183 private File checkLocal(URL url, String destDir, long maxTime) throws IOException { 182 184 String prefKey = getPrefKey(url, destDir); 183 String localPath = Main.pref.get(prefKey);184 185 File file = null; 185 if (localPath != null && localPath.length() > 0) { 186 String[] lp = localPath.split(";"); 186 // FIXME: replace with normal getCollection after july 2011 187 Collection<String> localPathEntry = Main.pref.getCollectionOld(prefKey, ";"); 188 if(localPathEntry.size() == 2) { 189 String[] lp = (String[]) localPathEntry.toArray(); 187 190 file = new File(lp[1]); 188 191 if(!file.exists()) … … 207 210 208 211 String a = url.toString().replaceAll("[^A-Za-z0-9_.-]", "_"); 209 localPath = "mirror_" + a;212 String localPath = "mirror_" + a; 210 213 destDirFile = new File(destDir, localPath + ".tmp"); 211 214 BufferedOutputStream bos = null; … … 226 229 file = new File(destDir, localPath); 227 230 destDirFile.renameTo(file); 228 Main.pref.put(prefKey, System.currentTimeMillis() + ";" + file); 231 Main.pref.putCollection(prefKey, Arrays.asList(new String[] 232 {Long.toString(System.currentTimeMillis()), file.toString()})); 229 233 } finally { 230 234 if (bis != null) {
Note:
See TracChangeset
for help on using the changeset viewer.