From 3029b6b065f7d455225cb65ca23f33a74858da4e Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Fri, 15 Apr 2016 09:59:36 +0300 Subject: [PATCH] 8145787: [TEST_BUG][PIT] javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java fails with CannotUndoException Reviewed-by: alexsch, serb --- .../AbstractDocumentUndoConcurrentTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java b/jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java index 30c48df47f8..a425f5a0fe0 100644 --- a/jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java +++ b/jdk/test/javax/swing/undo/UndoManager/AbstractDocumentUndoConcurrentTest.java @@ -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 @@ public class AbstractDocumentUndoConcurrentTest { 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"); }