diff --git a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java index 63981c7f48..6180616987 100644 --- a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java +++ b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java @@ -152,15 +152,16 @@ public class ClipboardBean if (index == -1) { // paste all - for (int i=0; i toRemove = new ArrayList(); + for (ClipboardItem item : this.items) { - ClipboardItem item = this.items.get(i); if (performClipboardOperation(item, action) == true) { // if cut operation then remove item from the clipboard if (item.getMode() == ClipboardStatus.CUT) { - this.items.remove(i); + // remember which items to remove. + toRemove.add(item); } } } @@ -170,6 +171,14 @@ public class ClipboardBean { this.items.clear(); } + else if (toRemove.size() > 0) + { + // remove the items that were cut above + for (ClipboardItem item : toRemove) + { + this.items.remove(item); + } + } } else {