[PATCH 2 of 2] Error message added if no bed height found for a calc range

Wald Commits scm-commit at wald.intevation.org
Mon Oct 1 09:56:31 CEST 2018


# HG changeset patch
# User mschaefer
# Date 1538380574 -7200
# Node ID 9ea704de63ee790f5cbafd64204a9026f014a90e
# Parent  6146358c48427f365f21c47e3db16e130e2cb7b0
Error message added if no bed height found for a calc range

diff -r 6146358c4842 -r 9ea704de63ee artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java	Mon Oct 01 09:53:36 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java	Mon Oct 01 09:56:14 2018 +0200
@@ -27,9 +27,9 @@
 import org.dive4elements.river.artifacts.common.ResultRow;
 import org.dive4elements.river.artifacts.model.Calculation;
 import org.dive4elements.river.artifacts.model.Calculation.Problem;
-import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.WQKms;
+import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.DischargeValuesFinder;
@@ -79,6 +79,11 @@
         }
 
         final double[] stations = extractStations(bedHeights);
+        if (stations.length == 0) {
+            final TkhCalculationResults results = new TkhCalculationResults(calcModeLabel, user, riverInfo, calcRange, "");
+            problems.addProblem("sinfo.bedheightsfinder.empty");
+            return new CalculationResult(results, problems);
+        }
 
         /* misuse winfo-artifact to calculate waterlevels in the same way */
         final WINFOArtifact winfo = new WinfoArtifactWrapper(sinfo);


More information about the Dive4Elements-commits mailing list