changeset 496:f14c5d1b5b71

Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions. gnv-artifacts/trunk@576 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 19 Jan 2010 16:47:25 +0000
parents 6e8364e766fa
children 75306d856004
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Tue Jan 19 14:06:10 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Tue Jan 19 16:47:25 2010 +0000
@@ -1,3 +1,11 @@
+2010-01-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue142
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Fixed an issue
+	  in timeseries chart caused by parameters with no value. Paid attention on
+	  array length.
+
 2010-01-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/raster/RasterToPPM.java: New.
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Tue Jan 19 14:06:10 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Tue Jan 19 16:47:25 2010 +0000
@@ -147,11 +147,13 @@
             endPos++;
         }
 
-        // add the last dataset if existing to plot and prepare its axis
-        startDate = results[startPos].getDate("XORDINATE");
-        endDate = results[endPos-1].getDate("XORDINATE");
-        addGaps(results, series, startDate, endDate, startPos, endPos);
-        addSeries(series, parameter, idx);
+        if (startPos < results.length && endPos-1 < results.length) {
+            // add the last dataset if existing to plot and prepare its axis
+            startDate = results[startPos].getDate("XORDINATE");
+            endDate = results[endPos-1].getDate("XORDINATE");
+            addGaps(results, series, startDate, endDate, startPos, endPos);
+            addSeries(series, parameter, idx);
+        }
 
         addDatasets();
     }

http://dive4elements.wald.intevation.org