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


Ignore:
Timestamp:
2015-07-15T21:20:51+02:00 (9 years ago)
Author:
wiktorn
Message:

Better error reporting in JCS, checkstyle fixes

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

Legend:

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

    r8602 r8604  
    199199     */
    200200    protected boolean isObjectLoadable() {
     201        if (cacheData == null) {
     202            return false;
     203        }
    201204        byte[] content = cacheData.getContent();
    202205        return content != null && content.length > 0;
     
    338341
    339342                attributes.setResponseCode(urlConn.getResponseCode());
    340                 byte[] raw = Utils.readBytesFromStream(urlConn.getInputStream());
     343                byte[] raw;
     344                if (urlConn.getResponseCode() == 200) {
     345                    raw = Utils.readBytesFromStream(urlConn.getInputStream());
     346                } else {
     347                    raw = new byte[]{};
     348                }
    341349
    342350                if (isResponseLoadable(urlConn.getHeaderFields(), urlConn.getResponseCode(), raw)) {
     
    440448        urlConn.setReadTimeout(readTimeout); // 30 seconds read timeout
    441449        urlConn.setConnectTimeout(connectTimeout);
    442         for (Map.Entry<String, String> e: headers.entrySet()) {
    443             urlConn.setRequestProperty(e.getKey(), e.getValue());
     450        if (headers != null) {
     451            for (Map.Entry<String, String> e: headers.entrySet()) {
     452                urlConn.setRequestProperty(e.getKey(), e.getValue());
     453            }
    444454        }
    445455        if (force) {
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r8598 r8604  
    142142        }
    143143
    144         private static final String[] getLayerNames(Collection<Layer> layers) {
     144        private static String[] getLayerNames(Collection<Layer> layers) {
    145145            Collection<String> ret = new ArrayList<>();
    146146            for (Layer layer: layers) {
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r8602 r8604  
    186186        }
    187187
    188 
    189188        if (tileLoader == null)
    190189            tileLoader = new OsmTileLoader(this);
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheContentsPanel.java

    r8600 r8604  
    5555public class CacheContentsPanel extends JPanel {
    5656
    57     private static class ButtonColumn extends AbstractCellEditor implements TableCellRenderer, TableCellEditor, ActionListener {
     57    private static final class ButtonColumn extends AbstractCellEditor implements TableCellRenderer, TableCellEditor, ActionListener {
    5858        private final Action action;
    5959        private final JButton renderButton;
Note: See TracChangeset for help on using the changeset viewer.