harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r494125 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/RepaintManager.java test/api/java/common/javax/swing/RepaintManagerTest.java
Date Mon, 08 Jan 2007 17:17:02 GMT
Author: odeakin
Date: Mon Jan  8 09:17:00 2007
New Revision: 494125

URL: http://svn.apache.org/viewvc?view=rev&rev=494125
Log:
Apply patch HARMONY-1725 ([swing] javax.swing.RepaintManager.addInvalidComponent(JComponent
jcomp) throws unspecified NPE)

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/RepaintManager.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/RepaintManagerTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/RepaintManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/RepaintManager.java?view=diff&rev=494125&r1=494124&r2=494125
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/RepaintManager.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/RepaintManager.java
Mon Jan  8 09:17:00 2007
@@ -23,6 +23,7 @@
 
 import java.awt.Color;
 import java.awt.Component;
+import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.EventQueue;
 import java.awt.Graphics;
@@ -269,12 +270,19 @@
     }
 
     private Component getValidationRoot(final Component c) {
+        if (c == null) {
+            return null;
+        }
         Component root = c;
-        while ((!(root instanceof JComponent) || !((JComponent)root)
-            .isValidateRoot())
-            && root.getParent() != null) {
-
-            root = root.getParent();
+        while (!(root instanceof JComponent)
+                || !((JComponent) root).isValidateRoot()) {
+            Container parent = root.getParent();
+
+            if (parent == null) {
+                break;
+            } else {
+                root = parent;
+            }
         }
         return root;
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/RepaintManagerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/RepaintManagerTest.java?view=diff&rev=494125&r1=494124&r2=494125
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/RepaintManagerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/RepaintManagerTest.java
Mon Jan  8 09:17:00 2007
@@ -101,6 +101,11 @@
         RepaintManager.currentManager(null).addInvalidComponent(inner);
         waitForIdle();
         assertTrue(marker.isOccurred());
+        try { // Regression test for HARMONY-1725
+            RepaintManager.currentManager(null).addInvalidComponent(null);
+        } catch (NullPointerException e) {
+            fail("Unexpected NullPointerException is thrown");
+        }
     }
 
     public void testValidateInvalidComponents() throws Exception {



Mime
View raw message