Changeset 10570 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-07-20T09:05:23+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13171 - Do not complain for non-existent files during cache cleanup (patch by michael2402) - gsoc-core

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java

    r10562 r10570  
    241241
    242242    private static void deleteCacheFiles(String basePathPart) {
    243         Utils.deleteFile(new File(basePathPart + ".key"));
    244         Utils.deleteFile(new File(basePathPart + ".data"));
     243        Utils.deleteFileIfExists(new File(basePathPart + ".key"));
     244        Utils.deleteFileIfExists(new File(basePathPart + ".data"));
    245245    }
    246246
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r10404 r10570  
    492492
    493493    /**
     494     * Deletes a file and log a default warning if the file exists but the deletion fails.
     495     * @param file file to delete
     496     * @return {@code true} if and only if the file does not exist or is successfully deleted; {@code false} otherwise
     497     * @since 10569
     498     */
     499    public static boolean deleteFileIfExists(File file) {
     500        if (file.exists()) {
     501            return deleteFile(file);
     502        } else {
     503            return true;
     504        }
     505    }
     506
     507    /**
    494508     * Deletes a file and log a default warning if the deletion fails.
    495509     * @param file file to delete
Note: See TracChangeset for help on using the changeset viewer.