Mercurial > dive4elements > river
changeset 6752:f275aae00c55
issue1433: Do not emit warning when tolerated empty string as value.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 06 Aug 2013 10:54:41 +0200 |
parents | aee8cb5c801a |
children | e032e9e6d09e |
files | backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java Mon Aug 05 15:24:44 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java Tue Aug 06 10:54:41 2013 +0200 @@ -199,7 +199,9 @@ } - /** Handle one line of data, add one value for all columns. */ + /** Handle one line of data, add one value for all columns. + * @param line the line to parse + */ private void handleDataLine(String line) { String[] cols = line.split(SEPERATOR_CHAR); @@ -209,6 +211,8 @@ } try { + // The first value in a line like 12,9;4,3;4,5 is the station, later + // real values. Double station = nf.parse(cols[0]).doubleValue(); for (int i = 0; i < columns.length; i++) { @@ -221,13 +225,15 @@ String value = cols[idx]; - try { - columns[i].addColumnValue( - new BigDecimal(station), - new BigDecimal(nf.parse(value).doubleValue())); - } - catch (ParseException pe) { - log.warn("Could not parse value: '" + value + "'"); + if (value != null && !value.equals("")) { + try { + columns[i].addColumnValue( + new BigDecimal(station), + new BigDecimal(nf.parse(value).doubleValue())); + } + catch (ParseException pe) { + log.warn("Could not parse value: '" + value + "'"); + } } } }