Changeset 34185 in osm


Ignore:
Timestamp:
2018-05-10T14:03:02+02:00 (6 years ago)
Author:
donvip
Message:

fix #josm16269 - use correct exception

Location:
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/TabReader.java

    r33613 r34185  
    1717import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     19import org.openstreetmap.josm.io.IllegalDataException;
    1920import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
    2021import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler;
     
    3738
    3839    public static DataSet parseDataSet(InputStream in, File file,
    39             AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {
     40            AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, IllegalDataException {
    4041        return new TabReader(handler).parse(in, file, instance, Charset.forName(OdConstants.ISO8859_15));
    4142    }
     
    7475    }
    7576
    76     private DataSet parse(InputStream in, File file, ProgressMonitor instance, Charset charset) throws IOException {
     77    private DataSet parse(InputStream in, File file, ProgressMonitor instance, Charset charset) throws IOException, IllegalDataException {
    7778        headerReader = new BufferedReader(new InputStreamReader(in, charset));
    7879        parseHeader();
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReader.java

    r33518 r34185  
    1010import org.openstreetmap.josm.data.osm.DataSet;
    1111import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     12import org.openstreetmap.josm.io.IllegalDataException;
    1213import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
    1314import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler;
     
    3334    }
    3435
    35     public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {
     36    public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance)
     37            throws IOException, IllegalDataException {
    3638        CsvHandler csvHandler = null;
    3739        if (handler != null && handler.getSpreadSheetHandler() instanceof CsvHandler) {
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsReader.java

    r33518 r34185  
    1515import org.openstreetmap.josm.data.osm.DataSet;
    1616import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     17import org.openstreetmap.josm.io.IllegalDataException;
    1718import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler;
    1819import org.openstreetmap.josm.tools.Logging;
     
    3233
    3334    public static DataSet parseDataSet(InputStream in,
    34             AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {
     35            AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, IllegalDataException {
    3536        return new OdsReader(handler != null ? handler.getSpreadSheetHandler() : null).parse(in, instance);
    3637    }
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java

    r33518 r34185  
    9494    }
    9595
    96     public DataSet doParse(String[] header, ProgressMonitor progressMonitor) throws IOException {
     96    public DataSet doParse(String[] header, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
    9797        Logging.info("Header: "+Arrays.toString(header));
    9898
     
    150150            if (!handlerOK) {
    151151                if (GraphicsEnvironment.isHeadless()) {
    152                     throw new IllegalArgumentException("No valid coordinates have been found and cannot prompt user in headless mode.");
     152                    throw new IllegalDataException("No valid coordinates have been found and cannot prompt user in headless mode.");
    153153                }
    154154                // TODO: filter proposed projections with min/max values ?
     
    163163
    164164        } else {
    165             throw new IllegalArgumentException(tr("No valid coordinates have been found."));
     165            throw new IllegalDataException(tr("No valid coordinates have been found."));
    166166        }
    167167
     
    195195
    196196            if (fields.length > header.length) {
    197                 Logging.warn(tr("Invalid file. Bad length on line {0}. Expected {1} columns, got {2}.", lineNumber, header.length, fields.length));
     197                Logging.warn(
     198                        tr("Invalid file. Bad length on line {0}. Expected {1} columns, got {2}.", lineNumber, header.length, fields.length));
    198199                Logging.warn(Arrays.toString(fields));
    199200            }
     
    268269    }
    269270
    270     public final DataSet parse(InputStream in, ProgressMonitor progressMonitor) throws IOException {
     271    public final DataSet parse(InputStream in, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
    271272
    272273        initResources(in, progressMonitor);
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/XlsReader.java

    r34072 r34185  
    1616import org.openstreetmap.josm.data.osm.DataSet;
    1717import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     18import org.openstreetmap.josm.io.IllegalDataException;
    1819import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler;
    1920import org.openstreetmap.josm.tools.Logging;
     
    3031
    3132    public static DataSet parseDataSet(InputStream in,
    32             AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {
     33            AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, IllegalDataException {
    3334        return new XlsReader(handler != null ? handler.getSpreadSheetHandler() : null).parse(in, instance);
    3435    }
Note: See TracChangeset for help on using the changeset viewer.