From 24f0f78b564e71580047cf0a0a5deb1d8aa369cd Mon Sep 17 00:00:00 2001 From: Mark Rogers Date: Tue, 22 Jul 2014 12:32:08 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud) 75496: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud) 74568: Issue a warning when finding a nodes that have the checkout-checkin aspects but where the association is missing - This is quite likely caused by the nodes cache being incorrect, which leads to the incorrect aspects being picked up - If you get the warning 'Found node with xyz aspect but no association", then the cache may be incorrect. - TODO: Recovery code, which is possible, if this turns out to be an issue git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77458 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/coci/CheckOutCheckInServiceImpl.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java index 13231c61ac..27ea037ff9 100644 --- a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java +++ b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java @@ -728,12 +728,16 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService { List assocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK); // It is a 1:1 relationship - if (assocs.size() > 0) + if (assocs.size() == 0) + { + logger.warn("Found node with cm:checkedOut aspect but no association. Current node state: " + nodeService.getNodeStatus(nodeRef)); + } + else if (assocs.size() > 1) + { + logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association from node: " + nodeRef); + } + else { - if (assocs.size() > 1) - { - logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association from node: " + nodeRef); - } workingCopy = assocs.get(0).getTargetRef(); } } @@ -749,12 +753,16 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService { List assocs = nodeService.getSourceAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK); // It is a 1:1 relationship - if (assocs.size() > 0) + if (assocs.size() == 0) + { + logger.warn("Found node with cm:workingcopy aspect but no association. Current node state: " + nodeService.getNodeStatus(nodeRef)); + } + else if (assocs.size() > 1) + { + logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association to node: " + nodeRef); + } + else { - if (assocs.size() > 1) - { - logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " associations to node: " + nodeRef); - } original = assocs.get(0).getSourceRef(); } }