harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r496107 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/org/apache/harmony/x/swing/Utilities.java test/api/java/common/javax/swing/plaf/basic/BasicArrowButtonTest.java
Date Sun, 14 Jan 2007 18:12:10 GMT
Author: hindessm
Date: Sun Jan 14 10:12:09 2007
New Revision: 496107

URL: http://svn.apache.org/viewvc?view=rev&rev=496107
Log:
Applying patches from "[#HARMONY-2707] [classlib][swing]
javax.swing.plaf.basic.BasicArrowButton.paintTriangle() throws unexpected
NPE when incorrect 'direction' parameter is passed in".  I modified the
test slightly to let junit handle the exceptions.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicArrowButtonTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java?view=diff&rev=496107&r1=496106&r2=496107
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
Sun Jan 14 10:12:09 2007
@@ -1102,6 +1102,7 @@
             break;
         default:
             assert false : "incorrect direction";
+            return;
         }
 
         final Color oldColor = g.getColor();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicArrowButtonTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicArrowButtonTest.java?view=diff&rev=496107&r1=496106&r2=496107
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicArrowButtonTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicArrowButtonTest.java
Sun Jan 14 10:12:09 2007
@@ -22,6 +22,9 @@
 
 import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
 import javax.swing.SwingConstants;
 import javax.swing.SwingTestCase;
 
@@ -55,6 +58,17 @@
     public void testFocusTraversable() throws Exception {
         assertFalse(button.isFocusTraversable());
     }
+    
+    /**
+     * Regression test for HARMONY-2707
+     * */
+    private static final int INCORRECT_DIRECTION = 10; 
+
+    public void testPaintTriangle() throws NullPointerException { 
+        Graphics2D g2D = new BufferedImage(6, 6, BufferedImage.TYPE_INT_RGB).createGraphics();

+        BasicArrowButton ab = new BasicArrowButton(0); 
+        ab.paintTriangle(g2D, 0, 0, 0, INCORRECT_DIRECTION, true); 
+    } 
     
     /**
      * Regression test for HARMONY-2629 



Mime
View raw message