Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8190763

Class cast exception on (CompoundEdit) UndoableEditEvent.getEdit()

XMLWordPrintable

    • b25
    • x86
    • other

        FULL PRODUCT VERSION :
        java version "9.0.1"
        Java(TM) SE Runtime Environment (build 9.0.1+11)
        Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 10.0.15063]

        A DESCRIPTION OF THE PROBLEM :

        Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to java.desktop/javax.swing.undo.CompoundEdit
        at CompoundEdit edit = (CompoundEdit) undoableEditEvent.getEdit();

        Caused by addition of DefaultDocumentEventUnoableWrapper instead of DefaultDocumentEvent in javax.swing.text.AbstractDocument.java


        REGRESSION. Last worked in version 8u151

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Extend javax.swing.undo.UndoManager

        2. Override public void undoableEditHappened(UndoableEditEvent e):
         
           javax.swing.undo.CompoundEdit edit = (javax.swing.undo.CompoundEdit)
           undoableEditEvent.getEdit();

        3. Compile and execute



        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        No class cast exception in undoableEditHappened
        ACTUAL -
        Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to java.desktop/javax.swing.undo.CompoundEdit

        at CompoundEdit edit = (CompoundEdit) undoableEditEvent.getEdit();

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        None

        I've seen this bug mentioned in another bug database but not here, so I'm writing this bug report in hopes that it will be fixed

              trebari Tejpal Rebari (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: