harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495970 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/MenuSelectionManager.java test/api/java/common/javax/swing/MenuSelectionManagerTest.java
Date Sat, 13 Jan 2007 21:15:37 GMT
Author: hindessm
Date: Sat Jan 13 13:15:36 2007
New Revision: 495970

URL: http://svn.apache.org/viewvc?view=rev&rev=495970
Log:
Applying patch from "[#HARMONY-2620] [classlib][swing]
javax.swing.MenuSelectionManager.processMouseEvent(null) does not throw
unspecified NPE".

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/MenuSelectionManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/MenuSelectionManager.java?view=diff&rev=495970&r1=495969&r2=495970
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/MenuSelectionManager.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/MenuSelectionManager.java
Sat Jan 13 13:15:36 2007
@@ -179,14 +179,16 @@
         }
     }
 
-    public void processMouseEvent(final MouseEvent event) {
+    public void processMouseEvent(final MouseEvent event) {   
+        Component c = componentForPoint((Component) event.getSource(), event.getPoint());
+
         if (isPathEmpty()) {
             return;
         }
 
-        Component c = componentForPoint((Component)event.getSource(), event.getPoint());
         if ((event.getID() == MouseEvent.MOUSE_DRAGGED)
-            || (event.getID() == MouseEvent.MOUSE_RELEASED)) {
+                || (event.getID() == MouseEvent.MOUSE_RELEASED)) {
+
             if (c instanceof JMenuItem) {
                 ((JMenuItem)c).processMouseEvent(event, selectedPath, this);
             }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java?view=diff&rev=495970&r1=495969&r2=495970
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java
Sat Jan 13 13:15:36 2007
@@ -364,6 +364,14 @@
         //
         //        manager.processMouseEvent(event4);
         //        assertEquals("released", listener1.event);
+
+        try {   
+            MenuSelectionManager m = new MenuSelectionManager(); 
+            m.processMouseEvent(null); 
+            fail("NPE should be thrown");
+        } catch (NullPointerException npe) {              
+            // PASSED            
+        }
     }
 
     /*



Mime
View raw message