Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/FlowDepthColumnParser.java @ 9656:31549fdfaf4f
Importer (s/u-info) extensions: flow-depth: uniform formatting of from-to series names,
warning instead of cancelling in case of missing column values,
detecting, logging and skipping columns with wrong unit,
better counting of inserted/updated values for each column
author | mschaefer |
---|---|
date | Mon, 23 Mar 2020 15:21:39 +0100 |
parents | 50416a0df385 |
children |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/FlowDepthColumnParser.java Mon Mar 23 15:16:35 2020 +0100 +++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/FlowDepthColumnParser.java Mon Mar 23 15:21:39 2020 +0100 @@ -44,8 +44,7 @@ /***** CONSTRUCTORS *****/ public FlowDepthColumnParser(final File importPath, final File rootRelativePath, final ImportRiver river, final FlowDepthSeriesImport parent, - final int colIndex, - final String colName) { + final int colIndex, final String colName) { super(importPath, rootRelativePath, river); this.parent = parent; this.colIndex = colIndex; @@ -62,7 +61,7 @@ @Override protected void logStartInfo() { - getLog().info(String.format("Start parsing column %d '%s':;'%s'", this.colIndex, this.colName, this.rootRelativePath)); + getLog().info(String.format("Start parsing column %d '%s':;'%s'", this.colIndex + 1, this.colName, this.rootRelativePath)); } @Override @@ -78,7 +77,11 @@ @Override protected FlowDepthKmLineImport createKmLineImport(final Double km, final String[] values) { - final double tkheight = parseDoubleWithNull(values[this.colIndex]).doubleValue(); - return new FlowDepthKmLineImport(km, tkheight); + final Number value = parseDoubleCheckNull(values, this.colIndex); + if ((value == null) || Double.isNaN(value.doubleValue())) { + logLineWarning("Column %d: " + INVALID_VALUE_ERROR_FORMAT, this.colIndex + 1, "depth"); + return null; + } + return new FlowDepthKmLineImport(km, value.doubleValue()); } }