changeset 9601:8f59aa01c22a

Fixed some warnings
author gernotbelger
date Tue, 12 Feb 2019 14:06:27 +0100
parents bf79a865f6df
children 6b2496d71936
files artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java
diffstat 1 files changed, 18 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java	Tue Feb 12 12:03:49 2019 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java	Tue Feb 12 14:06:27 2019 +0100
@@ -19,15 +19,24 @@
 import javax.swing.ImageIcon;
 
 import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.jfree.AxisDataset;
+import org.dive4elements.river.jfree.Bounds;
+import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
+import org.dive4elements.river.jfree.DoubleBounds;
+import org.dive4elements.river.jfree.RiverAnnotation;
+import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.themes.ThemeDocument;
 import org.jfree.chart.ChartFactory;
 import org.jfree.chart.JFreeChart;
-import org.jfree.chart.LegendItem;
 import org.jfree.chart.annotations.XYAnnotation;
 import org.jfree.chart.annotations.XYImageAnnotation;
 import org.jfree.chart.annotations.XYTextAnnotation;
+import org.jfree.chart.axis.LogarithmicAxis;
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.axis.LogarithmicAxis;
 import org.jfree.chart.plot.Marker;
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.chart.plot.XYPlot;
@@ -36,21 +45,9 @@
 import org.jfree.data.xy.XYDataset;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
-import org.jfree.ui.RectangleInsets;
 import org.json.JSONArray;
 import org.json.JSONException;
 
-import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
-import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.jfree.Bounds;
-import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
-import org.dive4elements.river.jfree.DoubleBounds;
-import org.dive4elements.river.jfree.RiverAnnotation;
-import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
-import org.dive4elements.river.jfree.StyledXYSeries;
-import org.dive4elements.river.jfree.AxisDataset;
-import org.dive4elements.river.themes.ThemeDocument;
-
 
 /**
  * An abstract base class for creating XY charts.
@@ -385,7 +382,7 @@
             return;
         }
 
-        AxisDataset axisDataset = (AxisDataset) getAxisDataset(index);
+        AxisDataset axisDataset = getAxisDataset(index);
 
         if (visible) {
             axisDataset.addDataset(area);
@@ -484,11 +481,8 @@
 
         DoubleBounds dBounds = (DoubleBounds) bounds;
 
-        if (dBounds == null
-            || Double.isNaN((Double) dBounds.getLower())
-            || Double.isNaN((Double) dBounds.getUpper())) {
+        if ( Double.isNaN((Double) dBounds.getLower()) || Double.isNaN((Double) dBounds.getUpper()))
             return;
-        }
 
         Bounds old = getXBounds(index);
 
@@ -509,11 +503,8 @@
 
         DoubleBounds dBounds = (DoubleBounds) bounds;
 
-        if (dBounds == null
-            || Double.isNaN((Double) dBounds.getLower())
-            || Double.isNaN((Double) dBounds.getUpper())) {
+        if ( Double.isNaN((Double) dBounds.getLower()) || Double.isNaN((Double) dBounds.getUpper()))
             return;
-        }
 
         Bounds old = getYBounds(index);
 
@@ -631,7 +622,7 @@
                 return new Range(from, to);
             }
             catch (NumberFormatException nfe) {
-                log.warn("Wrong values for domain axis range.");
+                log.warn("Wrong values for domain axis range.", nfe);
             }
         }
 
@@ -662,7 +653,7 @@
                        : new Range(from, to);
             }
             catch (NumberFormatException nfe) {
-                log.warn("Wrong values for value axis range.");
+                log.warn("Wrong values for value axis range.", nfe);
             }
         }
 
@@ -910,7 +901,7 @@
         XYSeries series = new StyledXYSeries(aandf.getFacetName(), seriesName, theme);
 
         // Add text annotations for single points.
-        List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
+        List<XYTextAnnotation> xy = new ArrayList<>();
 
         try {
             JSONArray points = new JSONArray((String) o);
@@ -929,7 +920,7 @@
             }
         }
         catch(JSONException e){
-            log.error("Could not decode json.");
+            log.error("Could not decode json.", e);
         }
 
         RiverAnnotation annotations =

http://dive4elements.wald.intevation.org