AnsweredAssumed Answered

Cannot get node content using onCreateNode behavior

Question asked by abraxas on Aug 31, 2011
Latest reply on Nov 10, 2014 by larsg.
I've created a custom Java behavior bound to the onCreateNode event that works just fine, except
that I can't retrieve the content from the node using:

ContentReader cReader = contentService.getReader(car.getChildRef(), nodeService.getType(car.getChildRef()));
String content = cReader.getContentString();
//car is the retrieved ChildAssociationRef 

I just get an nullPointerException on the first mentioned line when i run the code while I'm able to retrieve other properties without problems.
I'm interested if this is a known issue and if there is a workaround for retrieving the content node.

The content in this case is a string contained in a comment post node. My suspicion is that ContentReader can't retrieve the content node because
the node referenced is not yet available (not written) to alfresco at that moment.

If you need more information, please let me know.
Thanks.

Outcomes