# HG changeset patch # User gernotbelger # Date 1530875295 -7200 # Node ID 6a1580b38e7de0b1ec9e410072858c3dd5ca353c # Parent 0dcd1cd41915ac269617d79ea6366d778695461d Using a bed height without year in tkh calculation now throws an immediate error diff -r 0dcd1cd41915 -r 6a1580b38e7d artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java --- 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();