[PATCH] Potential fix for exception reported in flys/issue1717

Wald Commits scm-commit at wald.intevation.org
Wed May 28 12:26:45 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1401272773 -7200
# Node ID 8b8407c71ee2fd860b5877ea1cf5f4eebd04ea2e
# Parent  7d4bbe5ca102623c41cb4b4ad76432c57d3514ae
Potential fix for exception reported in flys/issue1717.

diff -r 7d4bbe5ca102 -r 8b8407c71ee2 artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java
--- 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);
             }


More information about the Dive4Elements-commits mailing list