Search code examples
javaalfrescoapache-chemistry

Apache chemistry internal server error on setContentStream


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??


Solution

  • I solved it with

      alfDoc.setContentStream(content, true, true);