Changeset 4298 in josm for trunk/src


Ignore:
Timestamp:
2011-08-08T00:22:04+02:00 (13 years ago)
Author:
stoecker
Message:

fix #6643 - patch mainly by simon04 - Exception when pasting URL into download bounding box window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r3083 r4298  
    22package org.openstreetmap.josm.tools;
    33
     4import java.io.UnsupportedEncodingException;
     5import java.net.URLDecoder;
    46import java.util.HashMap;
    57import java.util.Map;
     
    1214
    1315    public static Bounds parse(String url) {
     16        try {
     17            // a percent sign indicates an encoded URL (RFC 1738).
     18            if (url.contains("%")) {
     19                url = URLDecoder.decode(url, "UTF-8");
     20            }
     21        } catch (UnsupportedEncodingException x) {
     22        } catch (IllegalArgumentException x) {
     23        }
    1424        Bounds b = parseShortLink(url);
    1525        if (b != null)
     
    5060        } catch (NumberFormatException x) {
    5161        } catch (NullPointerException x) {
     62        } catch (ArrayIndexOutOfBoundsException x) {
    5263        }
    5364        return b;
Note: See TracChangeset for help on using the changeset viewer.