harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3112) [classlib][swing] j.s.undo.UndoManager.undoTo() and redoTo() throw CannotUndoException/CannotRedoException instead of ArrayIndexOutOfBoundsException
Date Thu, 01 Feb 2007 18:19:06 GMT

    [ 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.


Mime
View raw message