From a64183190040b63314ee4c3050cd079a9f10872d Mon Sep 17 00:00:00 2001 From: alandavis Date: Tue, 18 Dec 2018 06:08:25 +0000 Subject: [PATCH] REPO-4099 Change of mimetype to unsupported rendition hangs Share (#298) (#304) * REPO-4099 Change of mimetype to unsupported rendition hangs Share (#298) Only include URL and mimetype when working out the content hashCode as we don't want it to change if deleted. --- .../org/alfresco/repo/rendition2/RenditionService2Impl.java | 2 +- .../LegacyLocalTransformClientIntegrationTest.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java b/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java index b166c9e494..91b487eaa9 100644 --- a/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java @@ -494,7 +494,7 @@ public class RenditionService2Impl implements RenditionService2, InitializingBea if (contentData != null) { // Originally we used the contentData URL, but that is not enough if the mimetype changes. - String contentString = contentData.toString(); + String contentString = contentData.getContentUrl()+contentData.getMimetype(); if (contentString != null) { hashCode = contentString.hashCode(); diff --git a/src/test/java/org/alfresco/repo/rendition2/LegacyLocalTransformClientIntegrationTest.java b/src/test/java/org/alfresco/repo/rendition2/LegacyLocalTransformClientIntegrationTest.java index 09570b8421..fa64ea0788 100644 --- a/src/test/java/org/alfresco/repo/rendition2/LegacyLocalTransformClientIntegrationTest.java +++ b/src/test/java/org/alfresco/repo/rendition2/LegacyLocalTransformClientIntegrationTest.java @@ -137,10 +137,8 @@ public class LegacyLocalTransformClientIntegrationTest extends AbstractRendition // split into separate transactions as the client is async NodeRef sourceNode = transactionService.getRetryingTransactionHelper().doInTransaction(() -> createContentNodeFromQuickFile(testFileName)); - int sourceContentHashCode = DefaultTypeConverter.INSTANCE.convert( - ContentData.class, - nodeService.getProperty(sourceNode, PROP_CONTENT)) - .toString().hashCode(); + ContentData contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, nodeService.getProperty(sourceNode, PROP_CONTENT)); + int sourceContentHashCode = (contentData == null ? "" : contentData.getContentUrl()+contentData.getMimetype()).hashCode(); transactionService.getRetryingTransactionHelper().doInTransaction(() -> { RenditionDefinition2 renditionDefinition =