Hi there,
In the implementation of BorderLayout it could happen that the
xxxLayoutSize methods return wrong values. This is so because some
Components have Integer.MAX_VALUE for their getXXXSize and BorderLayout
sums them up, which leads to overflows and negative values for the
xxxLayoutSize methods. I fixed this.
2005-04-15 Roman Kennke <[EMAIL PROTECTED]>
* java/awt/BorderLayout.java
(calcSize): Check for overflow when component sizes are added.
/Roman
Index: java/awt/BorderLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/BorderLayout.java,v
retrieving revision 1.13
diff -u -r1.13 BorderLayout.java
--- java/awt/BorderLayout.java 16 Feb 2005 10:39:25 -0000 1.13
+++ java/awt/BorderLayout.java 16 Apr 2005 23:35:52 -0000
@@ -700,6 +700,10 @@
Dimension cdim = calcCompSize(center, what);
int width = edim.width + cdim.width + wdim.width + (hgap * 2);
+ // check for overflow
+ if (width < edim.width || width < cdim.width || width < cdim.width)
+ width = Integer.MAX_VALUE;
+
if (ndim.width > width)
width = ndim.width;
if (sdim.width > width)
@@ -713,7 +717,13 @@
if (wdim.height > height)
height = wdim.height;
- height += (ndim.height + sdim.height + (vgap * 2) + ins.top + ins.bottom);
+ int addedHeight = height + (ndim.height + sdim.height + (vgap * 2)
+ + ins.top + ins.bottom);
+ // check for overflow
+ if (addedHeight < height)
+ height = Integer.MAX_VALUE;
+ else
+ height = addedHeight;
return(new Dimension(width, height));
}
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches