This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: java.awt.Polygon bug fix in non-default constructor
- From: "Scott Gilbertson" <scottg at mantatest dot com>
- To: <java-patches at gcc dot gnu dot org>
- Date: Mon, 23 Dec 2002 11:30:35 -0500
- Subject: Patch: java.awt.Polygon bug fix in non-default constructor
This patch fixes a small but annoying bug in java.awt.Polygon. The default
constructor was fine, but the constructor that takes a pair of arrays was
failing to set the point count, so the polygon would draw with zero points
(i.e., not draw anything). I tested the fix by compiling and running a
previously-broken program which draws filled polygons, and it works fine.
Index: libjava/ChangeLog
from Scott Gilbertson <scottg@mantatest.com>
* java/awt/Polygon constructor: added missing assignment of this.npoints
diff -r -up gcc.patched/libjava/java/awt/Polygon.java
gcc/libjava/java/awt/Polygon.java
--- gcc.patched/libjava/java/awt/Polygon.java 2002-12-02
11:45:19.000000000 -0500
+++ gcc/libjava/java/awt/Polygon.java 2002-12-23 10:20:11.000000000 -0500
@@ -54,6 +54,7 @@ public class Polygon implements Shape, S
// ensure the new arrays are the same size.
this.xpoints = new int[npoints];
this.ypoints = new int[npoints];
+ this.npoints = npoints;
System.arraycopy (xpoints, 0, this.xpoints, 0, npoints);
System.arraycopy (ypoints, 0, this.ypoints, 0, npoints);
}