harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495975 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/JMenuBar.java test/api/java/common/javax/swing/JMenuBarTest.java
Date Sat, 13 Jan 2007 21:39:58 GMT
Author: hindessm
Date: Sat Jan 13 13:39:57 2007
New Revision: 495975

URL: http://svn.apache.org/viewvc?view=rev&rev=495975
Log:
Applying patch from "[#HARMONY-2624] [classlib][swing]
javax.swing.JMenuBar.getMenu(int) does not throw unspecified
ArrayIndexOutOfBoundsException".

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuBarTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java?view=diff&rev=495975&r1=495974&r2=495975
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java
Sat Jan 13 13:39:57 2007
@@ -117,10 +117,7 @@
                 : accessibleContext;
     }
 
-    public JMenu getMenu(int index) {
-        if (index < 0 || index >= getMenuCount()) {
-            return null;
-        }
+    public JMenu getMenu(int index) {        
         Component c = getComponent(index);
         return (c instanceof JMenu) ? (JMenu) c : null;
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuBarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuBarTest.java?view=diff&rev=495975&r1=495974&r2=495975
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuBarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuBarTest.java
Sat Jan 13 13:39:57 2007
@@ -149,6 +149,14 @@
         assertEquals(menu1, menuBar.getMenu(0));
         assertEquals(menu2, menuBar.getMenu(1));
         assertNull(menuBar.getMenu(2));
+
+        try {         
+            JMenuBar jm = new JMenuBar();
+            jm.getMenu(0);
+            fail("ArrayIndexOutOfBoundsException expected");
+        } catch (ArrayIndexOutOfBoundsException e) {    
+            // PASSED            
+        }
     }
 
     /*



Mime
View raw message