Changeset 4810 in josm
- Timestamp:
- 2012-01-17T14:09:10+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r4770 r4810 268 268 public File getPluginsDirectory() { 269 269 return new File(getPreferencesDirFile(), "plugins"); 270 } 271 272 public File getCacheDirectory() { 273 File cache = new File(getPreferencesDirFile(), "cache"); 274 if (!cache.exists() && !cache.mkdirs()) { 275 System.err.println(tr("Warning: Failed to create missing cache directory: {0}", cache.getAbsoluteFile())); 276 JOptionPane.showMessageDialog( 277 Main.parent, 278 tr("<html>Failed to create missing cache directory: {0}</html>",cache.getAbsoluteFile()), 279 tr("Error"), 280 JOptionPane.ERROR_MESSAGE 281 ); 282 } 283 return cache; 270 284 } 271 285 -
trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
r4709 r4810 78 78 this.ident = ident; 79 79 this.updateInterval = updateInterval; 80 this.path = new File(Main.pref.get PreferencesDir(), ident);80 this.path = new File(Main.pref.getCacheDirectory(), ident); 81 81 } 82 82 … … 86 86 */ 87 87 public byte[] updateIfRequired() throws T { 88 if(Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000 88 if (Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000 89 89 || !isCacheValid()) 90 90 return updateForce(); … … 97 97 */ 98 98 public String updateIfRequiredString() throws T { 99 if(Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000 99 if (Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000 100 100 || !isCacheValid()) 101 101 return updateForceString(); … … 121 121 updateForce(); 122 122 try { 123 return new String(data,"utf-8"); 124 } catch(UnsupportedEncodingException e){ 123 return new String(data, "utf-8"); 124 } catch (UnsupportedEncodingException e){ 125 125 e.printStackTrace(); 126 126 return ""; … … 133 133 */ 134 134 public byte[] getData() throws T { 135 if(data == null) { 135 if (data == null) { 136 136 loadFromDisk(); 137 137 } … … 156 156 */ 157 157 private void loadFromDisk() throws T { 158 if(Main.applet) 158 if (Main.applet) 159 159 this.data = updateForce(); 160 160 else { … … 164 164 input.read(this.data); 165 165 input.close(); 166 } catch(IOException e) { 166 } catch (IOException e) { 167 167 this.data = updateForce(); 168 168 } … … 174 174 */ 175 175 private void saveToDisk() { 176 if(Main.applet) 176 if (Main.applet) 177 177 return; 178 178 try {
Note:
See TracChangeset
for help on using the changeset viewer.