Changeset 4901 in josm for trunk/src


Ignore:
Timestamp:
2012-02-05T20:51:01+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #7361 - image filename with 3 commas causes exception

File:
1 edited

Legend:

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

    r4897 r4901  
    639639        if(s.startsWith("http:")) return DownloadParamType.httpUrl;
    640640        if(s.startsWith("file:")) return DownloadParamType.fileUrl;
    641         final StringTokenizer st = new StringTokenizer(s, ",");
    642         // we assume a string with exactly 3 commas is a bounds parameter
    643         if (st.countTokens() == 4) return DownloadParamType.bounds;
     641        String coorPattern = "\\s*[0-9]+(\\.[0-9]+)?\\s*";
     642        if(s.matches(coorPattern+"(,"+coorPattern+"){3}")) return DownloadParamType.bounds;
    644643        // everything else must be a file name
    645644        return DownloadParamType.fileName;
Note: See TracChangeset for help on using the changeset viewer.