onContentUpdate behaviour throws internal error

cancel
Showing results for 
Search instead for 
Did you mean: 
fsanna
Member II

onContentUpdate behaviour throws internal error

Hi, I'm developing my own extension of Alfresco Community Service using the platform jar. I defined a custom behaviour for the `onContentUpdate` policy that does some logic whenever a node is updated (I need to make it work whenever I update it through a API request, the PUT /node{nodeId}/content using binary data) returning a boolean value. If that boolean is true, the method throws a `PermissionDeniedException`.

The problem is that, for some reason, this exception I throw is always wrapped on a 500 exception, thrown by the `ContentServiceImpl` class; to be precise, it is thrown a ContentIoException with the phrase `Failed to set content property on stream closure: ...`. 

I don't understand what's going on here. It's like the property gets updated even if I don't want to. What could the problem be?

Thank you in advance!