This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve 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]

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

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