AnsweredAssumed Answered

How to get the proper exception message to the CMIS client

Question asked by signjoy on Jun 28, 2018
Latest reply on Jul 12, 2018 by signjoy



We have a policy that moves the document according to the metadata called state id. So if the state id is 123456. It will move the document to 123 -> 456 -> 123456 -> c.pdf


As and when document comes into  Alfresco through JAVA CMIS call, we check using NodeService whether the document is exists or not at the destination location. (123 -> 456 -> 123456 ->) . If it exists then we trow DuplicateChildNodeNameException like below.


message = "Duplicate child name not allowed c.pdf";
throw new DuplicateChildNodeNameException(docRef, ContentModel.ASSOC_CONTAINS, docName, new Exception(message));


The problem is even though we set the proper message in the exception, we are not getting the same message on the CMIS side. Instead we get below message...


Exception : 05280006 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnUpdateNodePolicy.onUpdateNode(org.alfresco.service.cmr.repository.NodeRef) in transaction 6f796a47-cdde-4930-b83a-c12fcf9de17d


Without policy code if I upload a document x.pdf into folder A and again I try to reupload a same document when x.pdf to folder A, it gives me proper exception on the CMIS side saying duplicate content or content already exists.  


How can I show the same message that Alfresco policy throws to the CMIS client?


Thank you in advance