changeset 9230:6a1580b38e7d

Using a bed height without year in tkh calculation now throws an immediate error
author gernotbelger
date Fri, 06 Jul 2018 13:08:15 +0200
parents 0dcd1cd41915
children 082e8e808902
files artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java	Thu Jul 05 16:49:42 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java	Fri Jul 06 13:08:15 2018 +0200
@@ -46,7 +46,13 @@
     }
 
     private BedHeightInfo(final BedHeight bedHeight) {
-        this.year = bedHeight.getYear();
+        final Integer bhYear = bedHeight.getYear();
+        if (bhYear == null) {
+            // REMARK: this should never happen, as we do not allow the user to select bed heights without a year information
+            throw new IllegalArgumentException("bedHeight has no year");
+        }
+
+        this.year = bhYear;
         this.description = bedHeight.getDescription();
         this.type = bedHeight.getType().getName();
         this.evaluationBy = bedHeight.getEvaluationBy();

http://dive4elements.wald.intevation.org