harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r521764 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/Container.java test/api/java/common/java/awt/ContainerRTest.java
Date Fri, 23 Mar 2007 15:27:56 GMT
Author: apetrenko
Date: Fri Mar 23 08:27:55 2007
New Revision: 521764

URL: http://svn.apache.org/viewvc?view=rev&rev=521764
Log:
Patch for HARMONY-3443 "[classlib][awt][netbeans] Container.paint() throws NPE"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java?view=diff&rev=521764&r1=521763&r2=521764
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
Fri Mar 23 08:27:55 2007
@@ -989,7 +989,7 @@
     private void paintComponentsImpl(Graphics g) {
         Shape clip;
         
-        if (g == null) {
+        if ((!isShowing()) || (g == null)) {
             return;
         }
         
@@ -999,7 +999,7 @@
             Component comp = children.get(i);
 
             if (comp.isLightweight() && comp.isVisible()) {
-                if (!clip.intersects(comp.getBounds())) {
+                if ((clip != null) && !clip.intersects(comp.getBounds())) {
                     continue;
                 }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java?view=diff&rev=521764&r1=521763&r2=521764
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java
Fri Mar 23 08:27:55 2007
@@ -17,6 +17,9 @@
 package java.awt;
 
 
+import javax.swing.DebugGraphics;
+import javax.swing.JButton;
+
 import junit.framework.TestCase;
 
 
@@ -63,6 +66,28 @@
         // Regression test for HARMONY-2527
         final Component c = new Frame();
         c.paint(c.getGraphics());
+        // End of regression for HARMONY-2527
+        
+        // Regression for HARMONY-3443
+        final Graphics g;
+        final Frame f = new Frame();
+
+        f.add(new JButton());
+        f.setVisible(true);
+        g = f.getGraphics();
+
+        try {
+            g.setClip(null);
+            assertNull(g.getClip());
+            f.paint(g);
+        } finally {
+            f.dispose();
+        }
+        // End of regression for HARMONY-3443
+        
+        // Regression for HARMONY-3430
+        new Container().paint(new DebugGraphics());
+        // End of regression for HARMONY-3430
     }
 
     public void testAddComponent() {



Mime
View raw message