Skip to content

Commit

Permalink
Minor code transformations suggested by Datadog Static Analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
jfree committed Jun 22, 2024
1 parent 1e92f69 commit 9911932
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/org/jfree/svg/SVGGraphics2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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]);
}
}
Expand Down

0 comments on commit 9911932

Please sign in to comment.