[PATCH] Correctly output problems in SedimentLoadDataCalculate

Wald Commits scm-commit at wald.intevation.org
Mon Aug 25 16:04:39 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1408975475 -7200
# Node ID 353f93d5d9f78af0516430998489e98a8e995a27
# Parent  f01c65261963b1eaf5f8f29bb167951277afc046
Correctly output problems in SedimentLoadDataCalculate

diff -r f01c65261963 -r 353f93d5d9f7 artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadDataCalculate.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadDataCalculate.java	Mon Aug 25 15:56:09 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadDataCalculate.java	Mon Aug 25 16:04:35 2014 +0200
@@ -21,6 +21,7 @@
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
 import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.Calculation;
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.ReportFacet;
@@ -145,7 +146,6 @@
             ? (CalculationResult) old
             : new SedimentLoadDataCalculation().calculate(access);
 
-        SedimentLoadDataResult sdRes;
 
         if (res == null) {
             logger.error ("No calculation result.");
@@ -154,15 +154,16 @@
         Object raw = res.getData();
         if (raw == null) {
             logger.warn("No result data.");
+            Calculation report = res.getReport();
+            if (report != null) {
+                logger.warn ("Problems : " + report.problemsToString());
+            }
             return res;
         }
 
+        SedimentLoadDataResult sdRes;
         if (raw instanceof SedimentLoadDataResult) {
             sdRes = (SedimentLoadDataResult) raw;
-        } else if (raw instanceof SedimentLoadDataCalculation) {
-            SedimentLoadDataCalculation calc = (SedimentLoadDataCalculation) raw;
-            logger.warn ("Problems : " + calc.problemsToString());
-            return calc;
         } else {
             logger.error ("Unknown result");
             return null;


More information about the Dive4Elements-commits mailing list