diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties
index dbb53e0559..96f6f06b8a 100644
--- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties
+++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties
@@ -37,4 +37,6 @@ rm.action.event-not-undone=The event {0} can't be undone, because it's not defin
rm.action.node-not-record-category=The disposition schedule could not be created, because the actioned upon node ({0}) was not a record category.
rm.action.parameter-not-supplied=The parameter ''{0}'' has not been supplied.
rm.action.delete-not-hold-type=The hold couldn't be deleted, because the node isn't of type {0}. (actionedUponNodeRef={1})
+rm.action.cast-to-rm-type=Can't upload a custom folder type to the records management file plan.
rm.action.record-folder-create=Operation failed, because you can't place a record folder into another record folder.
+
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java
index 659b509aa9..522cd5d96e 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java
@@ -27,6 +27,7 @@
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
+import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
@@ -43,6 +44,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
+import org.springframework.extensions.surf.util.I18NUtil;
/**
* rma:recordsManagementContainer behaviour bean.
@@ -69,6 +71,9 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
/** record folder service */
protected RecordFolderService recordFolderService;
+ /** I18N */
+ private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type";
+
/**
* @param identifierService identifier service
*/
@@ -151,6 +156,11 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
// This occurs if the RM folder has been created via IMap, WebDav, etc
if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT))
{
+ // Throw exception if the type is not cm:folder
+ if (!ContentModel.TYPE_FOLDER.equals(childType))
+ {
+ throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE));
+ }
// check the type of the parent to determine what 'kind' of artifact to create
NodeRef parent = childAssocRef.getParentRef();
QName parentType = nodeService.getType(parent);
diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3450Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3450Test.java
new file mode 100644
index 0000000000..6c325ab290
--- /dev/null
+++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3450Test.java
@@ -0,0 +1,70 @@
+/*
+ * #%L
+ * Alfresco Records Management Module
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
+import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel;
+import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
+import org.alfresco.util.GUID;
+import org.springframework.extensions.surf.util.I18NUtil;
+
+/**
+ * Integration test for RM-3450
+ *
+ * @author Roxana Lucanu
+ * @since 2.4.1
+ */
+public class RM3450Test extends BaseRMTestCase
+{
+
+ private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type";
+
+ public void testRM3450() throws Exception
+ {
+ doTestInTransaction(new FailureTest
+ (
+ I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE),
+ AlfrescoRuntimeException.class
+ )
+ {
+ @Override
+ public void run() throws Exception
+ {
+ transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback