# HG changeset patch # User gernotbelger # Date 1549976787 -3600 # Node ID 8f59aa01c22af2d1d8cdc54b65c8653aa12062ed # Parent bf79a865f6dfed148149499d6b737cbdd15f2b72 Fixed some warnings diff -r bf79a865f6df -r 8f59aa01c22a artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java --- 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 xy = new ArrayList(); + List 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 =