Skip to content

Commit

Permalink
Fix transcoding of line elements
Browse files Browse the repository at this point in the history
Do not use `PrintWriter.format` that is using current locale and thus can create incorrect floating number representation.

Fixes #406
  • Loading branch information
kirill-grouchnikov committed Sep 2, 2022
1 parent 3a755ad commit 8b2a705
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ public void format(String format, Object... args) {
this.currentWriter.format(format, args);
}

public void format(Locale l, String format, Object... args) {
this.currentWriter.format(l, format, args);
}

public void checkin() {
if (this.lines >= ROTATION_THRESHOLD) {
this.currentWriter.close();
Expand Down Expand Up @@ -380,8 +376,8 @@ private void transcodeShape(Shape shape, String suffix) throws UnsupportedOperat
Line2D l2df = (Line2D) shape;
printWriterManager.print("shape" + suffix + " = "
+ languageRenderer.getObjectCreation("Line2D.Float"));
printWriterManager.format("(%ff,%ff,%ff,%ff)", (float) l2df.getX1(), (float) l2df.getY1(),
(float) l2df.getX2(), (float) l2df.getY2());
printWriterManager.print("(" + (float) l2df.getX1() + "f," + (float) l2df.getY1() + "f,"
+ (float) l2df.getX2() + "f," + (float) l2df.getY2() + "f)");
printWriterManager.println(languageRenderer.getStatementEnd());
return;
}
Expand Down

0 comments on commit 8b2a705

Please sign in to comment.