You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey A. Ivanov (JIRA)" <ji...@apache.org> on 2006/12/12 14:16:22 UTC

[jira] Commented: (HARMONY-2643) [classlib][swing] j.s.undo.UndoManager.setLimit throws ArrayIndexOutOfBoundsException

    [ http://issues.apache.org/jira/browse/HARMONY-2643?page=comments#action_12457701 ] 
            
Alexey A. Ivanov commented on HARMONY-2643:
-------------------------------------------

Despite that the negative setting for limit is kept, it seems to not have any effect to object behavior: you can still add UndoableEdits to it, and they will be undone as if the limit was not changed. It might be a bug of RI. (Setting limit to 0, prevents you from adding edits to UndoManager.)

> [classlib][swing] j.s.undo.UndoManager.setLimit throws ArrayIndexOutOfBoundsException
> -------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2643
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2643
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>
> Harmony implementation of UndoManager throws ArrayIndexOutOfBoundsException where setLimit is called with negative value.
> ======= code to reproduce =======
> import javax.swing.undo.UndoManager;
> public class Test {
>     public static void main(String[] args) {
>         UndoManager um = new UndoManager();
>         um.setLimit(-1);
>         System.out.println(um.getLimit());
>         System.out.println("success");
>     }
> }
> ======= end of code =======
> ------- Harmony output -------
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
> 	at java.util.Vector.elementAt(Vector.java:326)
> 	at java.util.Vector.get(Vector.java:447)
> 	at javax.swing.undo.UndoManager.trimEdits(UndoManager.java:162)
> 	at javax.swing.undo.UndoManager.trimForLimit(UndoManager.java:245)
> 	at javax.swing.undo.UndoManager.setLimit(UndoManager.java:169)
> 	at Test.main(Test.java:6)
> ------- end of output -------
> ------- RI output -------
> -1
> success
> ------- end of output -------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira