From 27962726b4831609bea7eb250b85f3893a5d3688 Mon Sep 17 00:00:00 2001 From: Krystian Dabrowski <98942253+krdabrowski@users.noreply.github.com> Date: Wed, 2 Oct 2024 17:09:36 +0200 Subject: [PATCH] ACS-8871: Bump Spring from 6.0.19 to 6.1.13 (#2947) * ACS-8871: Bump Spring from 6.0.19 to 6.1.13 --- pom.xml | 2 +- .../repo/web/scripts/content/ContentGet.java | 59 ++++++++++--------- .../web-scripts-application-context.xml | 2 +- .../alfresco/repo/lock/LockServiceImpl.java | 2 +- scripts/ci/docker-compose/docker-compose.yaml | 2 +- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index 766cc4809c..115120b0f4 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 0.0.27 1.9.22.1 - 6.0.19 + 6.1.13 6.3.3 3.5.3 2.17.2 diff --git a/remote-api/src/main/java/org/alfresco/repo/web/scripts/content/ContentGet.java b/remote-api/src/main/java/org/alfresco/repo/web/scripts/content/ContentGet.java index b929343ac3..3c704cc308 100644 --- a/remote-api/src/main/java/org/alfresco/repo/web/scripts/content/ContentGet.java +++ b/remote-api/src/main/java/org/alfresco/repo/web/scripts/content/ContentGet.java @@ -25,15 +25,24 @@ */ package org.alfresco.repo.web.scripts.content; +import static java.util.Optional.ofNullable; +import static java.util.function.Predicate.not; + import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - import jakarta.servlet.ServletContext; import jakarta.servlet.http.HttpServletResponse; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; +import org.springframework.web.context.ServletContextAware; + import org.alfresco.model.ContentModel; import org.alfresco.repo.web.scripts.MimeTypeUtil; import org.alfresco.service.cmr.dictionary.DictionaryService; @@ -42,13 +51,6 @@ import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; -import org.springframework.web.context.ServletContextAware; - /** * Content Retrieval Service @@ -62,7 +64,7 @@ public class ContentGet extends StreamContent implements ServletContextAware // Logger @SuppressWarnings("unused") private static final Log logger = LogFactory.getLog(ContentGet.class); - + // Component dependencies private ServletContext servletContext; private DictionaryService dictionaryService; @@ -72,18 +74,19 @@ public class ContentGet extends StreamContent implements ServletContextAware private List nonAttachContentTypes = Collections.emptyList(); /** - * @param nonAttachContentTypes List + * @param nonAttachContentTypes + * List */ public void setNonAttachContentTypes(List nonAttachContentTypes) { - if (nonAttachContentTypes != null && !nonAttachContentTypes.isEmpty()) - { - this.nonAttachContentTypes = nonAttachContentTypes; - } + this.nonAttachContentTypes = ofNullable(nonAttachContentTypes) + .map(types -> types.stream().filter(not(String::isBlank)).toList()) + .orElse(Collections.emptyList()); } /** - * @param servletContext ServletContext + * @param servletContext + * ServletContext */ public void setServletContext(ServletContext servletContext) { @@ -91,23 +94,26 @@ public class ContentGet extends StreamContent implements ServletContextAware } /** - * @param dictionaryService DictionaryService + * @param dictionaryService + * DictionaryService */ public void setDictionaryService(DictionaryService dictionaryService) { - this.dictionaryService = dictionaryService; + this.dictionaryService = dictionaryService; } /** - * @param namespaceService NamespaceService + * @param namespaceService + * NamespaceService */ public void setNamespaceService(NamespaceService namespaceService) { - this.namespaceService = namespaceService; + this.namespaceService = namespaceService; } - + /** - * @param contentService ContentService + * @param contentService + * ContentService */ public void setContentService(ContentService contentService) { @@ -118,7 +124,7 @@ public class ContentGet extends StreamContent implements ServletContextAware * @see org.springframework.extensions.webscripts.WebScript#execute(WebScriptRequest, WebScriptResponse) */ public void execute(WebScriptRequest req, WebScriptResponse res) - throws IOException + throws IOException { // create map of args String[] names = req.getParameterNames(); @@ -127,10 +133,10 @@ public class ContentGet extends StreamContent implements ServletContextAware { args.put(name, req.getParameter(name)); } - + // create map of template vars Map templateVars = req.getServiceMatch().getTemplateVars(); - + // create object reference from url ObjectReference reference = createObjectReferenceFromUrl(args, templateVars); NodeRef nodeRef = reference.getNodeRef(); @@ -139,7 +145,6 @@ public class ContentGet extends StreamContent implements ServletContextAware throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + reference.toString()); } - // render content QName propertyQName = ContentModel.PROP_CONTENT; String contentPart = templateVars.get("property"); @@ -186,7 +191,7 @@ public class ContentGet extends StreamContent implements ServletContextAware if (attach && rfc5987Supported) { String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - + // maintain the original name of the node during the download - do not modify it - see MNT-16510 streamContent(req, res, nodeRef, propertyQName, attach, name, model); } @@ -195,4 +200,4 @@ public class ContentGet extends StreamContent implements ServletContextAware streamContent(req, res, nodeRef, propertyQName, attach, null, model); } } -} \ No newline at end of file +} diff --git a/remote-api/src/main/resources/alfresco/web-scripts-application-context.xml b/remote-api/src/main/resources/alfresco/web-scripts-application-context.xml index f255f96162..b1630853ec 100644 --- a/remote-api/src/main/resources/alfresco/web-scripts-application-context.xml +++ b/remote-api/src/main/resources/alfresco/web-scripts-application-context.xml @@ -250,7 +250,7 @@ - + diff --git a/repository/src/main/java/org/alfresco/repo/lock/LockServiceImpl.java b/repository/src/main/java/org/alfresco/repo/lock/LockServiceImpl.java index df0d2ea0b9..41b670c545 100644 --- a/repository/src/main/java/org/alfresco/repo/lock/LockServiceImpl.java +++ b/repository/src/main/java/org/alfresco/repo/lock/LockServiceImpl.java @@ -997,7 +997,7 @@ public class LockServiceImpl implements LockService, } // Never return a null LockState - Assert.notNull(lockState); + Assert.notNull(lockState, "The lockState should not be null"); return lockState; } diff --git a/scripts/ci/docker-compose/docker-compose.yaml b/scripts/ci/docker-compose/docker-compose.yaml index bf96f0d391..29604ba4bc 100644 --- a/scripts/ci/docker-compose/docker-compose.yaml +++ b/scripts/ci/docker-compose/docker-compose.yaml @@ -68,4 +68,4 @@ services: volumes: - ../../../repository/src/test/resources/realms/alfresco-realm.json:/opt/keycloak/data/import/alfresco-realm.json ports: - - 8999:8080 \ No newline at end of file + - 8999:8080