Changeset 8635 in josm


Ignore:
Timestamp:
2015-08-02T11:53:28+02:00 (6 years ago)
Author:
wiktorn
Message:

Fix Coverity warnings:

  • null pointer dereferences
  • make maksimum time element may be taken from cache to one year
Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

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

    r8624 r8635  
    5353    // Absolute expire time limit. Cached tiles that are older will not be used,
    5454    // even if the refresh from the server fails.
    55     protected static final long ABSOLUTE_EXPIRE_TIME_LIMIT = Long.MAX_VALUE; // unlimited
     55    protected static final long ABSOLUTE_EXPIRE_TIME_LIMIT = 1000L * 60 * 60 * 24 * 365; // 1 year
    5656
    5757    /**
     
    455455            }
    456456        }
     457
    457458        if (force) {
    458459            urlConn.setUseCaches(false);
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r8624 r8635  
    289289                    tile.finishLoading();
    290290                }
    291                 if (attributes.getResponseCode() >= 400) {
     291                if (attributes != null && attributes.getResponseCode() >= 400) {
    292292                    if (attributes.getErrorMessage() == null) {
    293293                        tile.setError(tr("HTTP error {0} when loading tiles", attributes.getResponseCode()));
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r8627 r8635  
    180180                this.currentLayer = layerSelection.getSelectedLayer();
    181181                // TODO: save layer information into ImageryInfo / ImageryPreferences?
    182             } else {
    183                 throw new IllegalArgumentException(tr("No layer selected")); //user canceled operation
    184             }
     182            }
     183
     184            if (this.currentLayer == null) {
     185                // user canceled operation or did not choose any layer
     186                throw new IllegalArgumentException(tr("No layer selected"));
     187            }
     188
    185189        } else if (layers.size() == 1) {
    186190            this.currentLayer = this.layers.iterator().next();
Note: See TracChangeset for help on using the changeset viewer.