Changeset 17913 in josm for trunk/src


Ignore:
Timestamp:
2021-05-25T15:54:33+02:00 (3 years ago)
Author:
simon04
Message:

fix 20239 - GeoJSONImporter: fix JsonException: Cannot auto-detect encoding, not enough chars

File:
1 edited

Legend:

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

    r17646 r17913  
    88import java.io.InputStream;
    99import java.util.Arrays;
     10import java.util.Locale;
    1011
     12import javax.json.JsonException;
    1113import javax.swing.JOptionPane;
    1214
     
    2325import org.openstreetmap.josm.io.IllegalDataException;
    2426import org.openstreetmap.josm.tools.Logging;
     27import org.openstreetmap.josm.tools.Utils;
    2528
    2629/**
     
    5255            progressMonitor.worked(1);
    5356            MainApplication.getLayerManager().addLayer(new OsmDataLayer(data, file.getName(), file));
    54         } catch (IOException | IllegalArgumentException | IllegalDataException e) {
     57        } catch (IOException | IllegalArgumentException | IllegalDataException | JsonException e) {
    5558            Logging.error("Error while reading json file!");
    5659            Logging.error(e);
    57             GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(
    58                 null, tr("Error loading geojson file {0}", file.getAbsolutePath()), tr("Error"), JOptionPane.WARNING_MESSAGE));
     60            String message = tr("Error loading geojson file {0}", file.getAbsolutePath())
     61                    + tr(" ({0})", Utils.getSizeString(file.length(), Locale.getDefault()));
     62            GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(null, message, tr("Error"), JOptionPane.WARNING_MESSAGE));
    5963        } finally {
    6064            progressMonitor.finishTask();
Note: See TracChangeset for help on using the changeset viewer.