I'm trying to replace a document on alfresco with Apache chemistry. I create an inputstream from a file stored on disk, i create a contenstream with the constructor ContentStreamImpl and i try to replace the document with the .setContentStream method. The result of this operation is
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
This is the part of my code:
InputStream newDoc = new FileInputStream(global.getPathTemp() + filename);
ContentStream content = new ContentStreamImpl("Prova", BigInteger.valueOf(newDoc.available()), mimetype, newDoc);
alfDoc.setContentStream(content, true);
Can someone help me??
I solved it with
alfDoc.setContentStream(content, true, true);