harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r496119 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicSpinnerUI.java test/api/java/common/javax/swing/plaf/basic/BasicSpinnerUITest.java
Date Sun, 14 Jan 2007 19:52:32 GMT
Author: hindessm
Date: Sun Jan 14 11:52:31 2007
New Revision: 496119

URL: http://svn.apache.org/viewvc?view=rev&rev=496119
Log:
Applying patches from "[#HARMONY-2716] [classlib][swing]
javax.swing.plaf.basic.BasicSpinnerUI.installNext/PreviousButtonListeners(C
omponent c) throw unspecified ClassCastException".  I modified the test
slightly to let junit handle the exceptions.

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSpinnerUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSpinnerUI.java?view=diff&rev=496119&r1=496118&r2=496119
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSpinnerUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSpinnerUI.java
Sun Jan 14 11:52:31 2007
@@ -264,6 +264,9 @@
     }
 
     protected void installNextButtonListeners(final Component c) {
+        if (!(c instanceof JButton)) {
+            return;
+        }
         JButton next = (JButton)c;
         next.addMouseListener(buttonHandler);
         next.addActionListener(buttonHandler);
@@ -271,6 +274,9 @@
     }
 
     protected void installPreviousButtonListeners(final Component c) {
+        if (!(c instanceof JButton)) {
+            return;
+        }
         JButton previous = (JButton)c;
         previous.addMouseListener(buttonHandler);
         previous.addActionListener(buttonHandler);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSpinnerUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSpinnerUITest.java?view=diff&rev=496119&r1=496118&r2=496119
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSpinnerUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSpinnerUITest.java
Sun Jan 14 11:52:31 2007
@@ -23,6 +23,7 @@
 import java.awt.Component;
 import java.util.Arrays;
 import javax.swing.BasicSwingTestCase;
+import javax.swing.JLabel;
 import javax.swing.JSpinner;
 import javax.swing.SwingConstants;
 
@@ -76,5 +77,31 @@
         ui.spinner = spinner;
         Component editor = ui.createEditor();
         assertSame(editor, spinner.getEditor());
+    }
+    
+    /**
+     * Regression test for HARMONY-2716 
+     * */
+    public void testInstallNextButtonListeners() throws ClassCastException {
+        BasicSpinnerUIForTest localBasicSpinnerUI = new BasicSpinnerUIForTest(); 
+        localBasicSpinnerUI.installNextButtonListeners(new JLabel()); 
+    } 
+
+    /**
+     * Regression test for HARMONY-2716 
+     * */
+    public void testInstallPreviousButtonListeners() throws ClassCastException {
+        BasicSpinnerUIForTest localBasicSpinnerUI = new BasicSpinnerUIForTest(); 
+        localBasicSpinnerUI.installPreviousButtonListeners(new JLabel()); 
+    } 
+
+    class BasicSpinnerUIForTest extends BasicSpinnerUI { 
+        public void installNextButtonListeners(Component c){ 
+            super.installNextButtonListeners(c); 
+        } 
+            
+        public void installPreviousButtonListeners(Component c){ 
+            super.installPreviousButtonListeners(c); 
+        } 
     }
 }



Mime
View raw message