changeset 2571:63f44b8b41a3

Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation). flys-artifacts/trunk@4099 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 01 Mar 2012 12:17:38 +0000
parents e123c5643f23
children 700f28bfd7ef
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Mar 01 12:12:20 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Mar 01 12:17:38 2012 +0000
@@ -1,3 +1,10 @@
+2012-03-01	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
+
+	* src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java:
+	  Do not add data pairs where a NaN is present.
+
 2012-03-01	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java	Thu Mar 01 12:12:20 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java	Thu Mar 01 12:17:38 2012 +0000
@@ -12,7 +12,8 @@
  */
 public class StyledSeriesBuilder {
 
-    private static final Logger logger = Logger.getLogger(StyledSeriesBuilder.class);
+    private static final Logger logger = Logger.getLogger
+        (StyledSeriesBuilder.class);
 
 
     /**
@@ -36,6 +37,10 @@
         double [] xPoints = points[0];
         double [] yPoints = points[1];
         for (int i = 0; i < xPoints.length; i++) {
+            if (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i])) {
+                logger.warn ("Skipping NaN in StyledSeriesBuilder.");
+                continue;
+            }
             series.add(xPoints[i], yPoints[i], false);
         }
     }

http://dive4elements.wald.intevation.org