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


Ignore:
Timestamp:
2020-02-16T22:29:06+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #18722 - exclude json file extension from GeoJsonImporter + add robustness

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/GeoJSONImporter.java

    r15588 r15865  
    3333
    3434    private static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
    35         "geojson,json", "geojson", tr("GeoJSON file") + " (*.geojson, *.geojson.gz, *.geojson.bz2, *.geojson.xz, *.geojson.zip, *.json)",
     35        "geojson", "geojson", tr("GeoJSON file") + " (*.geojson, *.geojson.gz, *.geojson.bz2, *.geojson.xz, *.geojson.zip)",
    3636        ExtensionFileFilter.AddArchiveExtension.NONE, Arrays.asList("gz", "bz", "bz2", "xz", "zip"));
    3737
  • trunk/src/org/openstreetmap/josm/io/GeoJSONReader.java

    r15785 r15865  
    7474    private void parseRoot(final JsonObject object) throws IllegalDataException {
    7575        parseCrs(object.getJsonObject(CRS));
    76         switch (object.getString(TYPE)) {
     76        switch (Optional.ofNullable(object.getJsonString(TYPE))
     77                .orElseThrow(() -> new IllegalDataException("No type")).getString()) {
    7778            case "FeatureCollection":
    7879                parseFeatureCollection(object.getJsonArray(FEATURES));
Note: See TracChangeset for help on using the changeset viewer.