changeset 8548:0011508d2f9d

(issue1754) Gracefully handle empty differenc results (e.g from km 0,001 to 0,002)
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 16 Feb 2015 15:27:39 +0100
parents 04367906f158
children 1cff4c98df76
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/DifferenceCurveFacet.java
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/DifferenceCurveFacet.java	Mon Feb 16 12:55:38 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/DifferenceCurveFacet.java	Mon Feb 16 15:27:39 2015 +0100
@@ -14,6 +14,7 @@
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.WINFOArtifact;
+import org.dive4elements.river.artifacts.model.WKmsImpl;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
 
@@ -54,11 +55,15 @@
 
         WKms [] wkms = (WKms [])res.getData();
 
-        WKms result = wkms[index];
-        log.debug("Got difference curve data (" + result.getName()
-            + ") at index: " + index);
-
-        return result;
+        if (wkms.length > 0) {
+            WKms result = wkms[index];
+            log.debug("Got difference curve data (" + result.getName()
+                + ") at index: " + index);
+            return result;
+        } else {
+            log.debug("Empty difference facet.");
+            return new WKmsImpl();
+        }
     }
 
 

http://dive4elements.wald.intevation.org