[PATCH] Sediment Density parser: avoid NPE when no year is given
Wald Commits
scm-commit at wald.intevation.org
Fri Aug 2 11:51:10 CEST 2013
# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1375437068 -7200
# Branch double-precision
# Node ID d3c6095813139032e6b2eb779771597a130bbb77
# Parent bd437771ea0039d681aafd04dcfde4dbcc3a73a6
Sediment Density parser: avoid NPE when no year is given
diff -r bd437771ea00 -r d3c609581313 backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentDensityParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentDensityParser.java Fri Aug 02 11:36:33 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentDensityParser.java Fri Aug 02 11:51:08 2013 +0200
@@ -177,12 +177,14 @@
}
BigDecimal year = null;
- try {
- year = new BigDecimal(nf.parse(yearString).doubleValue());
- }
- catch (ParseException pe) {
- log.warn("Unparseable year string");
- }
+ if (yearString != null) {
+ try {
+ year = new BigDecimal(nf.parse(yearString).doubleValue());
+ }
+ catch (ParseException pe) {
+ log.warn("Unparseable year string");
+ }
+ }
current.addValue(new ImportSedimentDensityValue(
km,
More information about the Dive4elements-commits
mailing list