You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/10/02 16:37:50 UTC

[jira] Updated: (HARMONY-4887) [classlib][awt] some AWT classes may cause a dead loop

     [ https://issues.apache.org/jira/browse/HARMONY-4887?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov updated HARMONY-4887:
-------------------------------------

    Attachment: H4887_Button.patch

> [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
>            Assignee: Alexei Zakharov
>         Attachments: H4887_Button.patch, H4887_ButtonRTest.patch
>
>
> 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.