changeset 3237:1cad94fa0817

Fix array-index-oobs in FixDeltaWtGenerator. flys-artifacts/trunk@4869 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 03 Jul 2012 17:51:52 +0000
parents b0eee4c1eaa0
children 112c3f0fc075
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jul 03 15:27:07 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jul 03 17:51:52 2012 +0000
@@ -1,3 +1,9 @@
+2012-07-03	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  Fix certain AIOOBs that were caused by the fact that QWDs can end up in two
+	  different series.
+
 2012-07-03  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Tue Jul 03 15:27:07 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Tue Jul 03 17:51:52 2012 +0000
@@ -270,6 +270,8 @@
 
         Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>();
 
+        int idxInterpol = 0;
+        int idxRegular = 0;
         for (int i = 0; i < qwds.length; i++) {
             if (qwds[i] == null) {
                 logger.debug("doAnalysisEventsOut: qwds[" + i + "] == null");
@@ -282,13 +284,13 @@
                 interpol.add(rtp, value);
                 annoIdxMap.put(
                     i,
-                    new int[]{1, i});
+                    new int[]{1, idxInterpol++});
             }
             else {
                 series.add(rtp, value);
                 annoIdxMap.put(
                     i,
-                    new int[]{0, i});
+                    new int[]{0, idxRegular++});
             }
         }
         tsc.addSeries(series);
@@ -348,6 +350,8 @@
 
         Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>();
 
+        int idxInterpol = 0;
+        int idxRegular = 0;
         for (int i = 0; i < qwds.length; i++) {
             if (qwds[i] == null) {
                 continue;
@@ -359,15 +363,14 @@
                 interpol.addOrUpdate(rtp, value);
                 annoIdxMap.put(
                     i,
-                    new int[]{1, i});
+                    new int[]{1, idxInterpol++});
             }
             else {
                 annoIdxMap.put(
                     i,
-                    new int[]{0, i});
+                    new int[]{0, idxRegular++});
                 series.addOrUpdate(rtp, value);
             }
-
         }
         tsc.addSeries(series);
         tsc.addSeries(interpol);

http://dive4elements.wald.intevation.org