harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r496039 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicListUI.java test/api/java/common/javax/swing/plaf/basic/BasicListUITest.java
Date Sun, 14 Jan 2007 08:59:17 GMT
Author: hindessm
Date: Sun Jan 14 00:59:16 2007
New Revision: 496039

URL: http://svn.apache.org/viewvc?view=rev&rev=496039
Log:
Applying patch from "[#HARMONY-2659] [classlib][swing][plaf]
javax.swing.plaf.basic.BasicListUI.locationToIndex(.., null) doesn't throw
unspecified NPE".

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicListUITest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java?view=diff&rev=496039&r1=496038&r2=496039
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java
Sun Jan 14 00:59:16 2007
@@ -432,6 +432,10 @@
     }
 
     public int locationToIndex(final JList list, final Point location) {
+        if (location == null) {
+            throw new NullPointerException();
+        }
+
         layouter.setList(list);
         maybeUpdateLayoutState();
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicListUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicListUITest.java?view=diff&rev=496039&r1=496038&r2=496039
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicListUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicListUITest.java
Sun Jan 14 00:59:16 2007
@@ -372,6 +372,15 @@
         assertEquals(0, ui.locationToIndex(list, new Point(3, 25)));
         assertEquals(1, ui.locationToIndex(list, new Point(50, 3)));
         assertEquals(1, ui.locationToIndex(list, new Point(50, 25)));
+
+        try {     
+            BasicListUI localBasicListUI = new BasicListUI();
+            javax.swing.JList localJList = new javax.swing.JList();
+            localBasicListUI.locationToIndex(localJList, null); 
+            fail("NPE should be thrown");
+        } catch (NullPointerException npe) {    
+            // PASSED          
+        }
     }
 
     public void testMaybeUpdateLayoutState() throws Exception {



Mime
View raw message