Changeset 4067 in josm for trunk


Ignore:
Timestamp:
2011-05-02T07:32:20+02:00 (14 years ago)
Author:
jttt
Message:

Better message (no stacktrace) when wms cache index file doesn't exist yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r4065 r4067  
    178178
    179179    public synchronized void loadIndex() {
     180        File indexFile = new File(cacheDir, INDEX_FILENAME);
    180181        try {
    181182            JAXBContext context = JAXBContext.newInstance(
     
    183184                    WmsCacheType.class.getClassLoader());
    184185            Unmarshaller unmarshaller = context.createUnmarshaller();
    185             WmsCacheType cacheEntries = (WmsCacheType)unmarshaller.unmarshal(
    186                     new FileInputStream(new File(cacheDir, INDEX_FILENAME)));
     186            WmsCacheType cacheEntries = (WmsCacheType)unmarshaller.unmarshal(new FileInputStream(indexFile));
    187187            totalFileSize = cacheEntries.getTotalFileSize();
    188188            if (cacheEntries.getTileSize() != tileSize) {
     
    201201            }
    202202        } catch (Exception e) {
    203             e.printStackTrace();
    204             System.out.println("Unable to load index for wms-cache, new file will be created");
     203            if (indexFile.exists()) {
     204                e.printStackTrace();
     205                System.out.println("Unable to load index for wms-cache, new file will be created");
     206            } else {
     207                System.out.println("Index for wms-cache doesn't exist, new file will be created");
     208            }
    205209        }
    206210
Note: See TracChangeset for help on using the changeset viewer.