changeset 7904:8b8407c71ee2

Potential fix for exception reported in flys/issue1717.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 28 May 2014 12:26:13 +0200
parents 7d4bbe5ca102
children 34fa3f8c20ed
files artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java	Tue May 27 19:56:13 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java	Wed May 28 12:26:13 2014 +0200
@@ -46,7 +46,7 @@
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.data.Range;
 import org.jfree.data.general.Series;
-import org.jfree.data.time.Day;
+import org.jfree.data.time.FixedMillisecond;
 import org.jfree.data.time.TimeSeries;
 import org.jfree.data.time.TimeSeriesCollection;
 import org.jfree.data.xy.XYDataset;
@@ -634,7 +634,7 @@
 
         // Add text annotations for single points.
         List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
-        HashMap<Day, String> names = new HashMap<Day, String>();
+        HashMap<FixedMillisecond, String> names = new HashMap<FixedMillisecond, String>();
 
         try {
             JSONArray points = new JSONArray((String) o);
@@ -649,8 +649,12 @@
                 }
 
                 Date date = decodeXAxisValue(array);
+                long ms = date.getTime();
 
-                Day day = new Day(date);
+                FixedMillisecond day = new FixedMillisecond(ms);
+                while (names.containsKey(day)) {
+                    day = new FixedMillisecond(++ms);
+                }
                 series.add(day, y, false);
                 names.put(day, name);
             }

http://dive4elements.wald.intevation.org