diff --git a/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java b/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java index fffaa46905..3f7081f17d 100644 --- a/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java +++ b/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java @@ -241,7 +241,6 @@ public class GpxDrawHelper implements SoMChangeListener, MapViewPaintable.LayerP /** maxTime saves the end time of the track as epoch seconds */ private double maxTime; - private void setupColors() { hdopAlpha = Config.getPref().getInt("hdop.color.alpha", -1); velocityScale = ColorScale.createHSBScale(256); diff --git a/src/org/openstreetmap/josm/tools/ColorScale.java b/src/org/openstreetmap/josm/tools/ColorScale.java index 3b421fe418..dde0392855 100644 --- a/src/org/openstreetmap/josm/tools/ColorScale.java +++ b/src/org/openstreetmap/josm/tools/ColorScale.java @@ -13,6 +13,7 @@ import java.time.Instant; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.util.Objects; import org.openstreetmap.josm.data.preferences.NamedColorProperty; @@ -204,6 +205,7 @@ public ColorScale makeTransparent(int alpha) { * @return This scale, for chaining */ public ColorScale addTitle(String title) { + Objects.requireNonNull(title); this.title = title; return this; } @@ -324,10 +326,8 @@ public void drawColorBar(final Graphics2D g, final int x, final int y, final int } // legend title - if (title != null) { - g.setColor(LEGEND_TITLE); - g.drawString(title, xRect + rectWidth / 2 - titleWidth / 2, y - fh * 3 / 2 - 10); - } + g.setColor(LEGEND_TITLE); + g.drawString(title, xRect + rectWidth / 2 - titleWidth / 2, y - fh * 3 / 2 - 10); // legend texts drawLegend(g, y, w, h, valueScale, fh, fw, xText); @@ -384,10 +384,8 @@ public void drawColorBarTime(final Graphics2D g, final int x, final int y, final } // legend title - if (title != null) { - g.setColor(LEGEND_TITLE); - g.drawString(title, xRect + rectWidth / 2 - titleWidth / 2, y - fh * 3 / 2 - padding / 2); - } + g.setColor(LEGEND_TITLE); + g.drawString(title, xRect + rectWidth / 2 - titleWidth / 2, y - fh * 3 / 2 - padding / 2); // legend texts drawTimeLegend(g, y, x, h, minVal, maxVal, fh, fw, xText);