harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4887) [classlib][awt] some AWT classes may cause a dead loop
Date Tue, 02 Oct 2007 12:18:50 GMT
[classlib][awt] some AWT classes may cause a dead loop
------------------------------------------------------

                 Key: HARMONY-4887
                 URL: https://issues.apache.org/jira/browse/HARMONY-4887
             Project: Harmony
          Issue Type: Bug
         Environment: any
            Reporter: Alexei Zakharov


The following AWT classes & methods may cause repaint dead loop:

java.awt
  Button
    setEnabled(boolean)
    setLabel(String)
  Checkbox
    setChecked(boolean)
    setEnabled(boolean)
  Choice
    select(int)
  Component
    setBackground(Color)
    setFont(Font)
    setForeground(Color)
  Label
    setEnabledImpl(boolean)
  TextComponent
    setEditable(boolean)
    setEnabled(boolean)
  TextField
    scrollRectToVisible(Rectangle)
    setEchoChar(char) 

Below is a simple reproducer for Button.setEnabled().

---
import java.awt.*;
import junit.framework.TestCase;

public class ButtonRTest extends TestCase {

    final static int DEAD_LOOP_TIMEOUT = 300;
    final static int VALID_NUMBER_OF_PAINT_CALLS = 3;

    public void testDeadLoopXXX() {
        final int count[] = new int[1];
        Button b = new Button() {
            public void paint(Graphics g) {
                count[0]++;
                setEnabled(true);
            }
        };
        new DummyFrame(b);
        try {
            Thread.sleep(DEAD_LOOP_TIMEOUT);
        } catch (Exception e) {}
        
        assertTrue("paint() called " + count[0] + " times, dead loop occurred",
                count[0] <= VALID_NUMBER_OF_PAINT_CALLS);
    }

    static class DummyFrame extends Frame {
        public DummyFrame(Component b){
            add(b);
            setSize(300,200);
            setVisible(true);
        } 
    }
}
---


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message