Changeset 29944 in osm


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

[JOSM_ImageryCache]: correct database cleaning, at last

Location:
applications/editors/josm/plugins/imagerycache
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagerycache/build.xml

    r29690 r29944  
    1515
    1616    <!-- enter the SVN commit message -->
    17     <property name="commit.message" value="JOSM/ImageryCache: add optional imagerycache.randomAccessFile parameter for slower but less system-dependent storage"/>
     17    <property name="commit.message" value="[JOSM_ImageryCache]: correct database cleaning, at last"/>
    1818    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    1919    <property name="plugin.main.version" value="5779"/>
  • applications/editors/josm/plugins/imagerycache/nbproject/project.xml

    r29769 r29944  
    1717                </source-folder>
    1818                <source-folder>
    19                     <label>F:\Java\josm\core\src</label>
    20                     <location>F:\Java\josm\core\src</location>
    21                 </source-folder>
    22                 <source-folder>
    23                     <label>F:\Java\josm\core\src</label>
     19                    <label>src</label>
    2420                    <type>java</type>
    25                     <location>F:\Java\josm\core\src</location>
     21                    <location>src</location>
    2622                    <encoding>UTF-8</encoding>
    2723                </source-folder>
     
    4844                <items>
    4945                    <source-folder style="packages">
    50                         <label>F:\Java\josm\core\src</label>
    51                         <location>F:\Java\josm\core\src</location>
     46                        <label>src</label>
     47                        <location>src</location>
    5248                    </source-folder>
    5349                    <source-file>
     
    6763        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
    6864            <compilation-unit>
    69                 <package-root>F:\Java\josm\core\src</package-root>
     65                <package-root>src</package-root>
    7066                <classpath mode="compile">../../core/src</classpath>
    7167                <source-level>1.6</source-level>
  • 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.