This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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);
   }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]