changeset 2156:4e0878695c5f

Made StyledSeriesBuilder more robust. flys-artifacts/trunk@3741 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 20 Jan 2012 10:23:27 +0000
parents 8c9c40459d8f
children c4ceade9d50e
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jan 20 09:38:43 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jan 20 10:23:27 2012 +0000
@@ -1,3 +1,8 @@
+2012-01-20  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java:
+	  Added null-guards to functions parameters.
+
 2012-01-20  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/HYKFactory.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java	Fri Jan 20 09:38:43 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java	Fri Jan 20 10:23:27 2012 +0000
@@ -48,6 +48,10 @@
      * @param points Points to add to series.
      */
     public static void addPoints(XYSeries series, WKms wkms) {
+        if (wkms == null) {
+            return;
+        }
+
         int size = wkms.size();
 
         for (int i = 0; i < size; i++) {
@@ -63,11 +67,15 @@
      * @param points Points to add to series.
      */
     public static void addPointsKmQ(XYSeries series, WQKms wqkms) {
-       int size = wqkms.size();
+        if (wqkms == null) {
+            return;
+        }
 
-       for (int i = 0; i < size; i++) {
-           series.add(wqkms.getKm(i), wqkms.getQ(i), false);
-       }
+        int size = wqkms.size();
+
+        for (int i = 0; i < size; i++) {
+            series.add(wqkms.getKm(i), wqkms.getQ(i), false);
+        }
     }
 
 
@@ -78,6 +86,10 @@
      * @param points Points to add to series.
      */
     public static void addPointsQW(XYSeries series, WQKms wqkms) {
+        if (wqkms == null) {
+            return;
+        }
+
         int size = wqkms.size();
 
         for (int i = 0; i < size; i++) {

http://dive4elements.wald.intevation.org