Mercurial > dive4elements > river
changeset 8688:e1186c5ab169
(issue1763) Empty strings are most likely intended as missing values, so don't try to parse them (plus enhanced logging).
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 15 Apr 2015 18:36:11 +0200 |
parents | 3912da70736b |
children | ea676691e533 |
files | backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java |
diffstat | 1 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java Wed Apr 15 17:30:27 2015 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java Wed Apr 15 18:36:11 2015 +0200 @@ -409,40 +409,44 @@ } Double height = null; - try { - height = new Double(nf.parse(values[1]).doubleValue()); - } - catch (ParseException e) { - log.warn("BSP: unparseable height " + values[1]); + if (values[1].length() > 0) { + try { + height = new Double(nf.parse(values[1]).doubleValue()); + } + catch (ParseException e) { + log.warn("BSP: unparseable height '" + values[1] + "'"); + } } Double uncertainty = null; - if (values.length > 2) { + if (values.length > 2 && values[2].length() > 0) { try { uncertainty = new Double(nf.parse(values[2]).doubleValue()); } catch (ParseException e) { - log.warn("BSP: unparseable uncertainty value " + values[2]); + log.warn("BSP: unparseable uncertainty value '" + + values[2] + "'"); } } Double dataGap = null; - if (values.length > 3) { + if (values.length > 3 && values[3].length() > 0) { try { dataGap = new Double(nf.parse(values[3]).doubleValue()); } catch (ParseException e) { - log.warn("BSP: unparseable data gap " + values[3]); + log.warn("BSP: unparseable data gap '" + values[3] + "'"); } } Double soundingWidth = null; - if (values.length > 4) { + if (values.length > 4 && values[4].length() > 0) { try { soundingWidth = new Double(nf.parse(values[4]).doubleValue()); } catch (ParseException e) { - log.warn("BSP: unparseable sounding width " + values[4]); + log.warn("BSP: unparseable sounding width '" + + values[4] + "'"); } }