This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Don't pass null String to LayoutManager#addLayoutComponent(String, Component)
- From: James Damour <james dot damour at request dot com>
- To: mauve-patches at sourceware dot org
- Date: Thu, 19 Jan 2006 11:42:43 -0500
- Subject: Don't pass null String to LayoutManager#addLayoutComponent(String, Component)
The attached patch tests to see if Container#addImpl passes a null
String to LayoutManager#addLayoutComponent(String, Component). The Sun
VMs do not.
Beware!! I don't have a working mauve test suite so this patch is
completely untested!!!
--
James Damour
I hang out on the FreeNode IRC in #classpath as Suvarov454
2006-01-19 James Damour <James.Damour@corp.request.com>
* java/awt/Container/addImpl.java
(test): Added check for non-null String passed to addLayoutComponent.
--- java/awt/Container/addImpl.java 2006-01-18 18:28:59.000000000 -0500
+++ java/awt/Container/addImpl.java.new 2006-01-18 18:40:56.000000000 -0500
@@ -95,6 +95,30 @@
componentAddedCalled = false;
c.add(new Component(){});
harness.check(componentAddedCalled, true);
+
+ Container two = new Container();
+ final TestHarness transfer = harness;
+ two.setLayout( new LayoutManager()
+ {
+ TestHarness harness = transfer;
+ Dimension size = new Dimension();
+ public void removeLayoutComponent(Component comp) {}
+ public java.awt.Dimension preferredLayoutSize(Container cont)
+ {
+ return size;
+ }
+ public Dimension minimumLayoutSize(Container cont)
+ {
+ return size;
+ }
+ public void layoutContainer(Container container) {}
+ public void addLayoutComponent(String name, Component comp)
+ {
+ bool pass = (name != null);
+ harness.check(pass, true);
+ }
+ } );
+ two.add(new Component(){});
}
}