changeset 774:d0a39efbfd96

Removed race-condition when trying to access the index of the next line color used in charts (applied patch in issue211). gnv-artifacts/trunk@834 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Mar 2010 10:06:36 +0000
parents 5fb1ea68e19c
children eedad2ddad14
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Fri Mar 26 09:55:28 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Fri Mar 26 10:06:36 2010 +0000
@@ -1,3 +1,11 @@
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue211 (Applied patch)
+
+	* src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Removed
+	  race-condition when trying to access the index of the next line color used
+	  in chart.
+
 2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Avoid danger to get
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java	Fri Mar 26 09:55:28 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java	Fri Mar 26 10:06:36 2010 +0000
@@ -259,14 +259,17 @@
 
         for (int i = 0; i < seriesCount; i++) {
             renderer.setSeriesShape(i, renderer.getSeriesShape(0));
-            renderer.setSeriesPaint(i, COLOR[nextColor%COLOR.length]);
+            renderer.setSeriesPaint(i, COLOR[nextColor() % COLOR.length]);
             renderer.setSeriesShapesVisible(i, renderShapes);
             renderer.setSeriesLinesVisible(i, renderLines);
-            nextColor++;
         }
         plot.setRenderer(idx, renderer);
     }
 
+    protected static synchronized int nextColor() {
+        return nextColor++;
+    }
+
 
     /**
      * Method to adjust the plot rendering. Disable horizontal grid lines if 

http://dive4elements.wald.intevation.org