I am using Open CMIS in Java for basic CRUD operations on Documentum. I am having trouble retrieving a document from Documentum and saving it to a file on disk. It appears as if the Document.getContentStream() method does not always complete before executing the next line of code. The result is an incomplete document that cannot be open. Here is some code:
1 Document document = (Document) session.getObject(objectId);
2 ContentStream contentStream = document.getContentStream();
3 InputStream inputStream = contentStream.getStream();
If I insert a sleep in between lines 2 and 3, it works fine, but I really don't want to rely on that or introduce a delay for every document. Any suggestions?