<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Sergey,<br class=""><div><br class=""><blockquote type="cite" class="">This version actually raised another question, do we really need DefaultDocumentEventUndoableWrapper<br class="">which transfers everything to the dde?</blockquote><div><br class=""></div><div><font size="2" class="">Without using DefaultDocumentEventUndoableWrapper the test <span style="font-family: Menlo; background-color: rgb(255, 255, 255);" class="">javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java</span></font></div><div><span style="background-color: rgb(255, 255, 255);" class=""><font size="2" face="Menlo" class="">Would fail.</font></span></div><font size="2" class=""><br class=""></font></div><div><font size="2" class="">The DefaultDocumentEventUndoableWrapper was introduced as a fix to JDK-8030702 to avoid deadlock between </font><span style="font-size: small;" class="">subclass of </span><span style="font-size: small;" class="">AbstractDocument and undoManager.</span></div><div><font size="2" class=""><br class=""></font></div><div><font size="2" class="">It has two methods lockEdit() and unlockEdit() which is not there in DefaultDocumentEvent.</font></div><div><font size="2" class="">These method are there in UndoableEditLockSupport which was also introduced as a fix of JDK-8030702.</font></div><div><font size="2" class=""><br class=""></font></div><div><font size="2" class="">Regards</font></div><div><font size="2" class="">Tejpal</font></div><div><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></span></div><div><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">Regards<br class="">Tejpal<br class=""><blockquote type="cite" class=""><br class="">On 11/11/19 11:04 pm, Pankaj Bansal wrote:<br class=""><blockquote type="cite" class="">Looks good to me<br class="">-Pankaj<br class="">*From:*Prasanta Sadhukhan<br class="">*Sent:* Tuesday, November 12, 2019 11:30 AM<br class="">*To:* Tejpal Rebari; Pankaj Bansal<br class="">*Cc:* <a href="mailto:swing-dev@openjdk.java.net" class="">swing-dev@openjdk.java.net</a> <<a href="mailto:swing-dev@openjdk.java.net" class="">mailto:swing-dev@openjdk.java.net</a>><br class="">*Subject:* Re: <Swing Dev> [14] RFR JDK-8190763 - Class cast exception on (CompoundEdit) UndoableEditEvent.getEdit()<br class="">Please remove ununsed imports from the test(no need for new webrev for me), other than that, looks ok to me.<br class="">Regards<br class="">Prasanta<br class="">On 12-Nov-19 11:24 AM, Tejpal Rebari wrote:<br class=""> Hi Prasanta,<br class=""> I have added try-finally in the main and called frame.dispose from finally clause.<br class=""> Please find the updated webrev<br class=""><a href="http://cr.openjdk.java.net/~trebari/swing/8190763/webrev3/" class="">http://cr.openjdk.java.net/~trebari/swing/8190763/webrev3/</a><br class=""> Regards<br class=""> Tejpal<br class=""> On 11-Nov-2019, at 4:34 PM, Prasanta Sadhukhan <prasanta.sadhukhan@oracle.com <mailto:prasanta.sadhukhan@oracle.com><mailto:prasanta.sadhukhan@oracle.com>> wrote:<br class=""> dispose is called from createTextArea when CCE is thrown so ideally the EDT should be inside dispose() function. I guess it will be clean if you remove dispose() from CCE and add frame.dispose() under try-finally clause in main() itself. I guess frame.setIconImage() also is not needed.<br class=""> Also, please add @Override annotation to run() method of EDT.<br class=""> On 11-Nov-19 3:07 PM, Tejpal Rebari wrote:<br class=""> Hi all,<br class=""> I have removed GridBagLayout() ,GridBagConstraints and author tag ,<br class=""> moved dispose() call to EDT<br class=""> and changed the test name to TestCCEOnEditEvet.<br class=""> Please find the updated webrev<br class="">http://cr.openjdk.java.net/~trebari/swing/8190763/webrev2/<br class=""> Regards<br class=""> Tejpal<br class=""> On 11-Nov-2019, at 12:02 PM, Pankaj Bansal <pankaj.b.bansal@oracle.com <mailto:pankaj.b.bansal@oracle.com><mailto:pankaj.b.bansal@oracle.com>> wrote:<br class=""> The fix look good to me.<br class=""> Some points about test case.<br class=""> 1.No need for author tag. This is not followed now.<br class=""> 2.The test case name should be something meaningful instead of bug***.<br class=""> 3.You should not need the GridBagConstraints code anywhere to reproduce the issue. You should remove this.<br class=""> Regards,<br class=""> Pankaj<br class=""> *From:*Prasanta Sadhukhan<br class=""> *Sent:*Monday, November 11, 2019 11:47 AM<br class=""> *To:*Tejpal Rebari<br class=""> *Cc:*swing-dev@openjdk.java.net <mailto:swing-dev@openjdk.java.net><mailto:swing-dev@openjdk.java.net><br class=""> *Subject:*Re: <Swing Dev> [14] RFR JDK-8190763 - Class cast exception on (CompoundEdit) UndoableEditEvent.getEdit()<br class=""> Fix looks ok to me. Regarding the test, dispose() should be called under EDT, just as you have done for createAndShowGUI().Also, I don't think createGridBagLayout() code is necessary to recreate the issue.<br class=""> Regards<br class=""> Prasanta<br class=""> On 08-Nov-19 3:56 PM, Tejpal Rebari wrote:<br class=""> Hi Prasanta ,<br class=""> I have added a test to the fix.<br class=""> Updated webrev :http://cr.openjdk.java.net/~trebari/swing/8190763/webrev1/<br class=""> Regards<br class=""> Tejpal<br class=""> On 31-Oct-2019, at 1:58 PM, Prasanta Sadhukhan <prasanta.sadhukhan@oracle.com <mailto:prasanta.sadhukhan@oracle.com><mailto:prasanta.sadhukhan@oracle.com>> wrote:<br class=""> Hi tejpal,<br class=""> Can you add a testcase to the fix? I guess one is there in the JBS itself.<br class=""> Regards<br class=""> Prasanta<br class=""> On 24-Oct-19 10:31 AM, Tejpal Rebari wrote:<br class=""> Hi All,<br class=""> Please review the following fix for jdk14.<br class=""> Bug:https://bugs.openjdk.java.net/browse/JDK-8190763<br class=""> Webrev:http://cr.openjdk.java.net/~trebari/swing/8190763/webrev0/<br class=""> Issue : This issue is a regression ofhttps://bugs.openjdk.java.net/browse/JDK-8030702.<br class=""> When UndoableEditEvent.getEdit() is casted to CompoundEdit, it throws class cast exception.<br class=""> Fix : In JDK-8030702 <https://bugs.openjdk.java.net/browse/JDK-8030702> a new class DefaultDocumentEventUndoableWrapper was introduced.<br class=""> UndoableEditEvent.getEdit() returns an object of DefaultDocumentEventUndoableWrapper and when it is casted to CompoundEdit it throws class cast exception because<br class=""> it doesn’t inherit CompoundEdit.<br class=""> Before the fix of JDK-8030702 <https://bugs.openjdk.java.net/browse/JDK-8030702> , UndoableEditEvent.getEdit() used to return an object of DefaultDocumentEvent which inherits CompoundEdit so the class cast exception was not thrown.<br class=""> The solution is to make DefaultDocumentEventUndoableWrapper a subclass of DefaultDocumentEvent.<br class=""> Testing : I have tested it on Mac, Windows and Ubuntu.<br class=""> Regards<br class=""> Tejpal<br class=""></blockquote><br class=""><br class="">--<br class="">Best regards, Sergey.<br class=""></blockquote></blockquote><br class=""><br class="">-- <br class="">Best regards, Sergey.<br class=""></div></div></blockquote></div><br class=""></body></html>