harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495558 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicTableUI.java test/api/java/common/javax/swing/plaf/basic/BasicTableUITest.java
Date Fri, 12 Jan 2007 11:38:54 GMT
Author: hindessm
Date: Fri Jan 12 03:38:50 2007
New Revision: 495558

URL: http://svn.apache.org/viewvc?view=rev&rev=495558
Log:
Applied fix and test patches from "[#HARMONY-1776] [classlib][swing]
javax.swing.plaf.basic.BasicTableUI.paint(null, JComponent) does not
throw unspecified  NPE".

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java?view=diff&rev=495558&r1=495557&r2=495558
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java
Fri Jan 12 03:38:50 2007
@@ -322,6 +322,9 @@
     }
 
     public void paint(final Graphics g, final JComponent c) {
+        if (g == null) {
+            throw new NullPointerException("context is null");
+        }
         if (table.getColumnCount() == 0 || table.getRowCount() == 0) {
             return;
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTableUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTableUITest.java?view=diff&rev=495558&r1=495557&r2=495558
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTableUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTableUITest.java
Fri Jan 12 03:38:50 2007
@@ -124,7 +124,6 @@
 
     public void testPaint() throws Exception {
         ui.table = new JTable();
-        ui.paint(null, null);
         DefaultTableModel model = (DefaultTableModel) ui.table.getModel();
         model.addColumn("column1");
         model.addRow(new Object[] { "1" });
@@ -132,6 +131,16 @@
         Graphics g = createTestGraphics();
         g.setClip(0, 0, 100, 100);
         ui.paint(g, null);
+    }
+
+    // Regression test for HARMONY-1776
+    public void testPaint_Null() throws Exception {
+        try {
+            ui.paint(null, null);
+            fail("NullPointerException should have been thrown");
+        } catch (NullPointerException e) {
+            // Expected
+        }
     }
 
     public void testInstallDefaults() throws Exception {



Mime
View raw message