harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r515098 - 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 Tue, 06 Mar 2007 12:14:52 GMT
Author: apetrenko
Date: Tue Mar  6 04:14:50 2007
New Revision: 515098

URL: http://svn.apache.org/viewvc?view=rev&rev=515098
Log:
Patch for HARMONY-2653 "[classlib][swing] javax.swing.plaf.basic.BasicListUI.getPreferredSize(new
JFileChooser() ) throws unspecified ClassCastException"

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=515098&r1=515097&r2=515098
==============================================================================
--- 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
Tue Mar  6 04:14:50 2007
@@ -426,9 +426,9 @@
 
     @Override
     public Dimension getPreferredSize(final JComponent c) {
-        JList list = (JList)c;
         maybeUpdateLayoutState();
 
+        JList list = (JList)c;
         layouter.setList(list);
         return layouter.getLayoutStrategy().getSize();
     }

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=515098&r1=515097&r2=515098
==============================================================================
--- 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
Tue Mar  6 04:14:50 2007
@@ -30,6 +30,7 @@
 import javax.swing.BorderFactory;
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.JComponent;
+import javax.swing.JFileChooser;
 import javax.swing.JList;
 import javax.swing.SwingTestCase;
 import javax.swing.SwingUtilities;
@@ -502,4 +503,18 @@
         assertFalse(list.isSelectedIndex(1));
         assertFalse(list.isSelectedIndex(2));
     }
+    
+    /**
+     * Regression test for HARMONY-2653 
+     * */
+    public void testRGetPreferredSize() { 
+        try { 
+            BasicListUI bl = new BasicListUI(); 
+            bl.getPreferredSize(new JFileChooser() ); 
+            fail("No NPE thrown"); 
+        } catch (NullPointerException e) { 
+            //expected 
+        }
+    } 
+
 }



Mime
View raw message