From 99119326ece94253fde1e21a5ee6375949447c4e Mon Sep 17 00:00:00 2001 From: David Gilbert Date: Sat, 22 Jun 2024 15:44:04 +0200 Subject: [PATCH] Minor code transformations suggested by Datadog Static Analyzer --- README.md | 4 ++++ src/main/java/org/jfree/svg/SVGGraphics2D.java | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ce0be4d..3da849e 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,10 @@ If you prefer not to be bound by the terms of the GPLv3, you can obtain an alter Change History -------------- +Version 5.0.6 (not yet released) +- minor code transformations suggested by the Datadog Static Analyzer +- update Maven and JUnit dependencies + Version 5.0.5 (19 February 2023) - fixed `drawArc()` and `fillArc()` - update Maven and JUnit dependencies diff --git a/src/main/java/org/jfree/svg/SVGGraphics2D.java b/src/main/java/org/jfree/svg/SVGGraphics2D.java index cc74972..aafbb11 100644 --- a/src/main/java/org/jfree/svg/SVGGraphics2D.java +++ b/src/main/java/org/jfree/svg/SVGGraphics2D.java @@ -356,7 +356,7 @@ public final class SVGGraphics2D extends Graphics2D { * field will contain the reference id that is used in the DEFS element * for that linear gradient. */ - private String gradientPaintRef = null; + private String gradientPaintRef; /** * The device configuration (this is lazily instantiated in the @@ -404,6 +404,7 @@ public SVGGraphics2D(double width, double height, SVGUnits units) { */ public SVGGraphics2D(double width, double height, SVGUnits units, StringBuilder sb) { + super(); Args.requireFinitePositive(width, "width"); Args.requireFinitePositive(height, "height"); Args.nullNotPermitted(sb, "sb"); @@ -1336,10 +1337,10 @@ private String rgbColorStr(Color c) { private String rgbaColorStr(Color c) { StringBuilder b = new StringBuilder("rgba("); double alphaPercent = c.getAlpha() / 255.0; - b.append(c.getRed()).append(",").append(c.getGreen()).append(",") + b.append(c.getRed()).append(',').append(c.getGreen()).append(',') .append(c.getBlue()); - b.append(",").append(transformDP(alphaPercent)); - b.append(")"); + b.append(',').append(transformDP(alphaPercent)); + b.append(')'); return b.toString(); } @@ -1405,7 +1406,9 @@ private String strokeStyle() { if (dashArray != null && dashArray.length != 0) { b.append(";stroke-dasharray:"); for (int i = 0; i < dashArray.length; i++) { - if (i != 0) b.append(","); + if (i != 0) { + b.append(","); + } b.append(dashArray[i]); } }