changeset 8126:353f93d5d9f7

Correctly output problems in SedimentLoadDataCalculate
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 25 Aug 2014 16:04:35 +0200
parents f01c65261963
children 8c5eb9edc3f3
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadDataCalculate.java
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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;

http://dive4elements.wald.intevation.org