Changeset 34185 in osm
- Timestamp:
- 2018-05-10T14:03:02+02:00 (6 years ago)
- 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 17 17 import org.openstreetmap.josm.data.osm.DataSet; 18 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 import org.openstreetmap.josm.io.IllegalDataException; 19 20 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 20 21 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; … … 37 38 38 39 public static DataSet parseDataSet(InputStream in, File file, 39 AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {40 AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, IllegalDataException { 40 41 return new TabReader(handler).parse(in, file, instance, Charset.forName(OdConstants.ISO8859_15)); 41 42 } … … 74 75 } 75 76 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 { 77 78 headerReader = new BufferedReader(new InputStreamReader(in, charset)); 78 79 parseHeader(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReader.java
r33518 r34185 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 12 import org.openstreetmap.josm.io.IllegalDataException; 12 13 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 13 14 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; … … 33 34 } 34 35 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 { 36 38 CsvHandler csvHandler = null; 37 39 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 15 15 import org.openstreetmap.josm.data.osm.DataSet; 16 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 17 import org.openstreetmap.josm.io.IllegalDataException; 17 18 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 18 19 import org.openstreetmap.josm.tools.Logging; … … 32 33 33 34 public static DataSet parseDataSet(InputStream in, 34 AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {35 AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, IllegalDataException { 35 36 return new OdsReader(handler != null ? handler.getSpreadSheetHandler() : null).parse(in, instance); 36 37 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java
r33518 r34185 94 94 } 95 95 96 public DataSet doParse(String[] header, ProgressMonitor progressMonitor) throws IOException {96 public DataSet doParse(String[] header, ProgressMonitor progressMonitor) throws IOException, IllegalDataException { 97 97 Logging.info("Header: "+Arrays.toString(header)); 98 98 … … 150 150 if (!handlerOK) { 151 151 if (GraphicsEnvironment.isHeadless()) { 152 throw new Illegal ArgumentException("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."); 153 153 } 154 154 // TODO: filter proposed projections with min/max values ? … … 163 163 164 164 } else { 165 throw new Illegal ArgumentException(tr("No valid coordinates have been found."));165 throw new IllegalDataException(tr("No valid coordinates have been found.")); 166 166 } 167 167 … … 195 195 196 196 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)); 198 199 Logging.warn(Arrays.toString(fields)); 199 200 } … … 268 269 } 269 270 270 public final DataSet parse(InputStream in, ProgressMonitor progressMonitor) throws IOException {271 public final DataSet parse(InputStream in, ProgressMonitor progressMonitor) throws IOException, IllegalDataException { 271 272 272 273 initResources(in, progressMonitor); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/XlsReader.java
r34072 r34185 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 import org.openstreetmap.josm.io.IllegalDataException; 18 19 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 19 20 import org.openstreetmap.josm.tools.Logging; … … 30 31 31 32 public static DataSet parseDataSet(InputStream in, 32 AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {33 AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, IllegalDataException { 33 34 return new XlsReader(handler != null ? handler.getSpreadSheetHandler() : null).parse(in, instance); 34 35 }
Note:
See TracChangeset
for help on using the changeset viewer.