harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r479024 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/MenuBar.java test/api/java/common/java/awt/MenuBarTest.java
Date Fri, 24 Nov 2006 22:16:50 GMT
Author: tellison
Date: Fri Nov 24 14:16:49 2006
New Revision: 479024

URL: http://svn.apache.org/viewvc?view=rev&rev=479024
Log:
Applied patch HARMONY-2227 ([classlib][awt] MenuBar methods remove(MenuComponent) and setHelpMenu(Menu)
throw unspecified NPE for null parameters)

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuBar.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuBar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuBar.java?view=diff&rev=479024&r1=479023&r2=479024
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuBar.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuBar.java
Fri Nov 24 14:16:49 2006
@@ -184,6 +184,7 @@
     }
 
     public void remove(MenuComponent menu) {
+        if (menu == null) return;
         toolkit.lockAWT();
         try {
             menuList.remove(menu);
@@ -311,9 +312,6 @@
     }
 
     public void setHelpMenu(Menu menu) {
-        if (menu == null) {
-            throw new NullPointerException();
-        }
         toolkit.lockAWT();
         try {
             if (helpMenu == menu) {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java?view=diff&rev=479024&r1=479023&r2=479024
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/MenuBarTest.java
Fri Nov 24 14:16:49 2006
@@ -113,4 +113,24 @@
         MenuItem mi = mb.getShortcutMenuItem(ms);
         assertNull(mi);
     }
+    
+    public void testRemove1() {
+        MenuBar m = new MenuBar();
+        try {
+            m.remove(null);
+            assertTrue(true);
+        } catch (Throwable t) {
+            fail("Unexpected exception : " + t);
+        }
+    }
+    
+    public void testSetHelpMenu() {
+        MenuBar m = new MenuBar();
+        try {
+            m.setHelpMenu(null);
+            assertTrue(true);
+        } catch (Throwable t) {
+            fail("Unexpected exception : " + t);
+        }
+    }
 }



Mime
View raw message