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

[jira] Commented: (HARMONY-3112) [classlib][swing] j.s.undo.UndoManager.undoTo() and redoTo() throw CannotUndoException/CannotRedoException instead of ArrayIndexOutOfBoundsException

    [ https://issues.apache.org/jira/browse/HARMONY-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469534 ] 

Vasily Zakharov commented on HARMONY-3112:
------------------------------------------

Here's a test reproducing the issue:

import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoManager;
import javax.swing.undo.UndoableEdit;

public class Test {
    public static void main(String[] args) {
        UM um = new UM();
        um.addEdit(new AbstractUndoableEdit());

        try {
            um.undoTo(null);
        } catch (CannotUndoException e) {
            System.out.println("CannotUndoException caught at undoTo(null)");
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("ArrayIndexOutOfBoundsException caught at undoTo(null)");
        }

        try {
            um.redoTo(null);
        } catch (CannotRedoException e) {
            System.out.println("CannotRedoException caught at redoTo(null)");
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("ArrayIndexOutOfBoundsException caught at redoTo(null)");
        }
    }
    
    private static class UM extends UndoManager {
        @Override
        public void redoTo(UndoableEdit edit) {
            super.redoTo(edit);
        }
        
        @Override
        public void undoTo(UndoableEdit edit) {
            super.undoTo(edit);
        }
    }
}

Output on RI:

ArrayIndexOutOfBoundsException caught at undoTo(null)
ArrayIndexOutOfBoundsException caught at redoTo(null)

Output on Harmony:

CannotUndoException caught at undoTo(null)
CannotRedoException caught at redoTo(null)


> [classlib][swing] j.s.undo.UndoManager.undoTo() and redoTo() throw CannotUndoException/CannotRedoException instead of ArrayIndexOutOfBoundsException
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3112
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3112
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Vasily Zakharov
>            Priority: Minor
>
> javax.swing.undo.UndoManager.undoTo(edit) and redoTo(edit) methods throw CannotUndoException or CannotRedoException correspondingly when the specified edit is not found.
> RI throws ArrayIndexOutOfBoundsException in these situations.
> Harmony implementation reaction looks more appropriate and adequate to the specification, so considering this a non-bug difference.

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