Ignore:
Timestamp:
2013-09-23T19:18:42+02:00 (12 years ago)
Author:
akks
Message:

[JOSM_ImageryCache]: correct database cleaning, at last

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/TileDAOMapDB.java

    r29769 r29944  
    189189    public void cleanStorage(String name) {
    190190        Main.info("Cleaning storage: {0}", name);
    191         dbs.get(name).close();
    192         for (int t=0; t<20; t++) {
    193             try {
     191        Main.info("There were {0} tiles in it", storages.get(name).size());
     192        try {
     193            dbs.get(name).close();
     194            dbs.remove(name);
     195            storages.remove(name);
     196            for (int t=0; t<20; t++) {
    194197                String fname = getDBFileName(name, t);
    195198                File f = new File(cacheFolder, fname);
    196199                if (!f.exists() || !f.canWrite()) continue;
    197200                f.delete();
    198             } catch (Exception e) {
    199                 Main.warn("Can not delete file");
     201                f = new File(cacheFolder, fname+".p");
     202                if (!f.exists() || !f.canWrite()) continue;
     203                f.delete();
     204                f = new File(cacheFolder, fname+".lock");
     205                if (!f.exists() || !f.canWrite()) continue;
     206                f.delete();
    200207            }
    201         }
     208        } catch (Exception e) { Main.warn("Can not delete file, maybe it is locvked by another JOSM instance. This is not a serious error then."); }
    202209    }
    203210}
Note: See TracChangeset for help on using the changeset viewer.