Changeset 12679 in josm for trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
- Timestamp:
- 2017-08-27T23:42:54+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r12636 r12679 7 7 import java.net.URL; 8 8 import java.util.ArrayList; 9 import java.util.Arrays; 9 10 import java.util.Collection; 10 11 import java.util.Collections; … … 35 36 import org.openstreetmap.josm.io.BoundingBoxDownloader; 36 37 import org.openstreetmap.josm.io.OsmServerLocationReader; 38 import org.openstreetmap.josm.io.OsmServerLocationReader.OsmUrlPattern; 37 39 import org.openstreetmap.josm.io.OsmServerReader; 38 40 import org.openstreetmap.josm.io.OsmTransferCanceledException; … … 48 50 public class DownloadOsmTask extends AbstractDownloadTask<DataSet> { 49 51 50 // CHECKSTYLE.OFF: SingleSpaceSeparator51 protected static final String PATTERN_OSM_API_URL = "https?://.*/api/0.6/(map|nodes?|ways?|relations?|\\*).*";52 protected static final String PATTERN_OVERPASS_API_URL = "https?://.*/interpreter\\?data=.*";53 protected static final String PATTERN_OVERPASS_API_XAPI_URL = "https?://.*/xapi(\\?.*\\[@meta\\]|_meta\\?).*";54 protected static final String PATTERN_EXTERNAL_OSM_FILE = "https?://.*/.*\\.osm";55 // CHECKSTYLE.ON: SingleSpaceSeparator56 57 52 protected Bounds currentBounds; 58 53 protected DownloadTask downloadTask; … … 66 61 public String[] getPatterns() { 67 62 if (this.getClass() == DownloadOsmTask.class) { 68 return new String[]{PATTERN_OSM_API_URL, PATTERN_OVERPASS_API_URL, 69 PATTERN_OVERPASS_API_XAPI_URL, PATTERN_EXTERNAL_OSM_FILE}; 63 return Arrays.stream(OsmUrlPattern.values()).map(OsmUrlPattern::pattern).toArray(String[]::new); 70 64 } else { 71 65 return super.getPatterns(); … … 408 402 if (url != null) { 409 403 String urlString = url.toExternalForm(); 410 if (urlString.matches( PATTERN_OSM_API_URL)) {404 if (urlString.matches(OsmUrlPattern.OSM_API_URL.pattern())) { 411 405 // TODO: proper i18n after stabilization 412 406 Collection<String> items = new ArrayList<>();
Note:
See TracChangeset
for help on using the changeset viewer.