diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/rules/CreateRulesTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/rules/CreateRulesTests.java index 9835597b1c..81dce032ec 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/rules/CreateRulesTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/rules/CreateRulesTests.java @@ -2,7 +2,7 @@ * #%L * Alfresco Repository * %% - * Copyright (C) 2005 - 2022 Alfresco Software Limited + * Copyright (C) 2005 - 2025 Alfresco Software Limited * %% * This file is part of the Alfresco software. * If the software was purchased under a paid Alfresco license, the terms of @@ -747,7 +747,7 @@ public class CreateRulesTests extends RulesRestTest .createSingleRule(ruleModel); restClient.assertStatusCodeIs(NOT_FOUND); - restClient.assertLastError().containsSummary("The entity with id: non-existent-node was not found"); + restClient.assertLastError().containsSummary("Destination folder having Id: non-existent-node no longer exists. Please update your rule definition."); } /** diff --git a/remote-api/src/main/java/org/alfresco/rest/api/impl/validator/actions/ActionNodeParameterValidator.java b/remote-api/src/main/java/org/alfresco/rest/api/impl/validator/actions/ActionNodeParameterValidator.java index 8e67ed5c83..5ebb36e827 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/impl/validator/actions/ActionNodeParameterValidator.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/impl/validator/actions/ActionNodeParameterValidator.java @@ -2,7 +2,7 @@ * #%L * Alfresco Remote API * %% - * Copyright (C) 2005 - 2022 Alfresco Software Limited + * Copyright (C) 2005 - 2025 Alfresco Software Limited * %% * This file is part of the Alfresco software. * If the software was purchased under a paid Alfresco license, the terms of @@ -75,6 +75,7 @@ public class ActionNodeParameterValidator implements ActionValidator static final String NO_PROPER_PERMISSIONS_FOR_NODE = "No proper permissions for node: "; static final String NOT_A_CATEGORY = "Node is not a category "; static final String NOT_A_FOLDER = "Node is not a folder "; + static final String NO_LONGER_EXISTS = "%s having Id: %s no longer exists. Please update your rule definition."; private final Actions actions; private final NamespaceService namespaceService; @@ -132,7 +133,15 @@ public class ActionNodeParameterValidator implements ActionValidator .filter(pd -> action.getParams().containsKey(pd.getName())) .forEach(p -> { final String nodeId = Objects.toString(action.getParams().get(p.getName()), Strings.EMPTY); - final NodeRef nodeRef = nodes.validateNode(nodeId); + NodeRef nodeRef; + try + { + nodeRef = nodes.validateNode(nodeId); + } + catch (EntityNotFoundException e) + { + throw new EntityNotFoundException(String.format(NO_LONGER_EXISTS, p.getDisplayLabel(), nodeId), e); + } validatePermission(action.getActionDefinitionId(), p.getName(), nodeRef); validateType(action.getActionDefinitionId(), nodeRef); }); @@ -169,4 +178,5 @@ public class ActionNodeParameterValidator implements ActionValidator throw new InvalidArgumentException(NOT_A_CATEGORY + nodeRef.getId()); } } + }