harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r544078 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/border/EmptyBorder.java main/java/common/javax/swing/border/MatteBorder.java test/api/java.injected/javax/swing/border/MatteBorderTest.java
Date Mon, 04 Jun 2007 07:03:14 GMT
Author: ayza
Date: Mon Jun  4 00:03:13 2007
New Revision: 544078

URL: http://svn.apache.org/viewvc?view=rev&rev=544078
Log:
Applying patch from HARMONY-2589 ([classlib][swing][plaf] javax.swing.plaf.BorderUIResource.MatteBorderUIResource(null)
throws NPE)

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/EmptyBorder.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/MatteBorder.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/border/MatteBorderTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/EmptyBorder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/EmptyBorder.java?view=diff&rev=544078&r1=544077&r2=544078
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/EmptyBorder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/EmptyBorder.java
Mon Jun  4 00:03:13 2007
@@ -50,8 +50,8 @@
      *  This constructor initialize vertical and horizontal insets
      *  with the same value
      *
-     * @param <code>topBottom</code> - specifies vertical (top and bottom) insets
-     * @param <code>leftRight</code> - specifies horizontal (left and right)
insets
+     * @param topBottom - specifies vertical (top and bottom) insets
+     * @param leftRight - specifies horizontal (left and right) insets
      *
      */
     EmptyBorder(final int topBottom, final int leftRight) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/MatteBorder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/MatteBorder.java?view=diff&rev=544078&r1=544077&r2=544078
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/MatteBorder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/border/MatteBorder.java
Mon Jun  4 00:03:13 2007
@@ -46,10 +46,12 @@
     }
 
     public MatteBorder(final Icon tileIcon) {
-        super(tileIcon.getIconHeight(), tileIcon.getIconWidth());
-
-        this.tileIcon = tileIcon;
-    }
+		// null vervfication has been added according to HARMONY-2589
+		super((tileIcon == null) ? -1 : tileIcon.getIconHeight(),
+				(tileIcon == null) ? -1 : tileIcon.getIconWidth());
+		
+		this.tileIcon=tileIcon;
+	}
 
     public MatteBorder(final int top, final int left, final int bottom, final int right,
final Icon tileIcon) {
         super(top, left, bottom, right);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/border/MatteBorderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/border/MatteBorderTest.java?view=diff&rev=544078&r1=544077&r2=544078
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/border/MatteBorderTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/border/MatteBorderTest.java
Mon Jun  4 00:03:13 2007
@@ -85,10 +85,20 @@
     public void testMatteBorderIcon() {
         Icon icon = new ImageIcon(new BufferedImage(20, 20, BufferedImage.TYPE_BYTE_GRAY));
         MatteBorder border = new MatteBorder(icon);
+        Insets insets;
+
         assertEquals("icon value coinsides", icon, border.getTileIcon());
         icon = new ImageIcon(new BufferedImage(30, 40, BufferedImage.TYPE_4BYTE_ABGR));
         border = new MatteBorder(icon);
         assertEquals("icon value coinsides", icon, border.getTileIcon());
+        
+        //Regression test for HARMONY-2589
+        border = new MatteBorder(null);
+        insets = border.getBorderInsets();
+        assertEquals(-1, insets.top);
+        assertEquals(-1, insets.bottom);
+        assertEquals(-1, insets.left);
+        assertEquals(-1, insets.right);
     }
 
     /*
@@ -307,5 +317,5 @@
         color = Color.YELLOW;
         border = new MatteBorder(top, left, bottom, right, color);
         assertEquals("Colors coinside ", color, border.getMatteColor());
-    }
-}
+    }    
+}
\ No newline at end of file



Mime
View raw message