AnsweredAssumed Answered

CheckIn Document's can't preview or view in Share

Question asked by blacksylo on Feb 19, 2015
Latest reply on Jul 24, 2015 by ememic
Hi, I'm using Alfresco Community Edition 5.0, and OpenCmis 0.12.0

I've been uploading documents and viewing them in Share without problems using OpenCmis, but when the content of the document changes in anyway(making updates) there is no preview or view in Share anymore.

Been trying with:

String fileName = filepart.getFilename();
File file = filepart.getFile();
String mimeType = new MimetypesFileTypeMap().getContentType(file);

ObjectId idOfCheckedOutDocument = doc.checkOut();
Document pwc = (Document) session.getObject(idOfCheckedOutDocument);

FileInputStream fis = new FileInputStream(file);
DataInputStream dis = new DataInputStream(fis);
ContentStream cs = session.getObjectFactory().createContentStream(fileName, Long.valueOf(file.length()), mimeType,dis);
ObjectId objectId = pwc.checkIn(false, null, cs, "");

And tried doc.setContentStream() directly, which works but gives the exact same result. The doc gets in someway damaged or something happens that makes Share unable to preview or view the document.

If only the properties are updated using "doc.updateProperties()" then the document is still visible and everythings ok, but the need is to store another version of the document.

Also tried with the same code to create the contentSteam while making the uploads but still no luck.

ContentStream cs = new ContentStreamImpl(

This is really strange, is there something I am not seeing here?

The files are being stored correctly after the checkIn() in Share for Downloads, I mean, even when theres no preview, you can Download it and see the content correclty, its just in the Share viewer after theres a checkIn() or setContentStream();

Thanks for the help!