8145787: [TEST_BUG][PIT] javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java fails with CannotUndoException
authorssadetsky
Fri, 15 Apr 2016 09:59:36 +0300
changeset 37696 b8c2433a9c34
parent 37695 7fd2a68f1318
child 37697 9bdfdb90249b
8145787: [TEST_BUG][PIT] javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java fails with CannotUndoException Reviewed-by: alexsch, serb
jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java
--- a/jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java	Fri Apr 15 09:54:27 2016 +0300
+++ b/jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java	Fri Apr 15 09:59:36 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,8 +104,12 @@
                     e.printStackTrace();
                 }
                 for (int i = 0; i < 1000; i++) {
-                    undoManager.undoOrRedo();
-                    undoManager.undo();
+                    if(undoManager.canUndoOrRedo()) {
+                        undoManager.undoOrRedo();
+                    }
+                    if(undoManager.canUndo()) {
+                        undoManager.undo();
+                    }
                 }
                 System.out.println("t3 done");
             }