Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

59897: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3)
      59791: Merged DEV to V4.2-BUG-FIX (4.2.2)
         59719: MNT-10178 : BM-0012: Run v420b1527_01: Cannot find Content Reader for document RenditionServiceException
         Added a check to skip the nodes without content before trying to render.
         Fixed test.
         59739: MNT-10178 : BM-0012: Run v420b1527_01: Cannot find Content Reader for document RenditionServiceException
         Corrected mistakes in the fix r59719.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62216 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 09:29:21 +00:00
parent ee70662f17
commit 96c87c2d9c
2 changed files with 99 additions and 87 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2010 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.action.ExecutionSummary;
import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.rendition.RenderCallback; import org.alfresco.service.cmr.rendition.RenderCallback;
import org.alfresco.service.cmr.rendition.RenditionCancelledException;
import org.alfresco.service.cmr.rendition.RenditionDefinition; import org.alfresco.service.cmr.rendition.RenditionDefinition;
import org.alfresco.service.cmr.rendition.RenditionService; import org.alfresco.service.cmr.rendition.RenditionService;
import org.alfresco.service.cmr.rendition.RenditionServiceException; import org.alfresco.service.cmr.rendition.RenditionServiceException;
@@ -381,8 +382,27 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
protected void executeImpl(final RenditionDefinition renditionDef, final NodeRef sourceNode) protected void executeImpl(final RenditionDefinition renditionDef, final NodeRef sourceNode)
{ {
if (nodeService.exists(sourceNode) == true) // Don't render the nodes without content.
// MNT-10178
if (!nodeService.exists(sourceNode))
{ {
if (logger.isDebugEnabled() == true)
{
logger.debug("Rendition has not been created, because the node no longer exists. (sourceNode=" + sourceNode + ")");
}
notifyCallbackOfException(renditionDef, new RenditionCancelledException("Rendition was cancelled, because the node no longer exists."));
return;
}
else if (nodeService.getProperty(sourceNode, ContentModel.PROP_CONTENT) == null)
{
if (logger.isDebugEnabled() == true)
{
logger.debug("Rendition has not been created, because the node has no content to render. (sourceNode=" + sourceNode + ")");
}
notifyCallbackOfException(renditionDef, new RenditionCancelledException("Rendition was cancelled, because the node has no content to render."));
return;
}
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
@@ -463,14 +483,6 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
} }
}, runAsName); }, runAsName);
} }
else
{
if (logger.isDebugEnabled() == true)
{
logger.debug("Rendition has not been created, because the node no longer exitst. (sourceNode=" + sourceNode + ")");
}
}
}
/** /**
* Is this a standalone rendition, or is it a sub-component of * Is this a standalone rendition, or is it a sub-component of

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2013 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -1218,7 +1218,7 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
performAsyncRendition(testTargetFolder, callback, latch, results); performAsyncRendition(testTargetFolder, callback, latch, results);
assertNull(results.getAssoc()); assertNull(results.getAssoc());
assertEquals("Expected a RenditionServiceException", RenditionServiceException.class, results.getThrowable().getClass()); assertEquals("Expected a RenditionServiceException", RenditionCancelledException.class, results.getThrowable().getClass());
} }
/** /**