We had this strange error when trying to cancelCheckout of a document, it still created a new version. we are using Alfresco Enterprise 4.1.1, Chemistry OpenCMIS 0.8 We saw in the log the cancelCheckout, but still a new version is created. any idea?
Here is my code snapshot
Document pwc = null ;
try {
//check it out
pwc = (Document) session.getObject(origDoc.checkOut());
//create the content stream
ContentStream contentStream = session.getObjectFactory().createContentStream(origDoc.getContentStream().getFileName(), newVersion.length,
origDoc.getContentStream().getMimeType(), new ByteArrayInputStream(newVersion));
// Check in the pwc
if(pwc!=null){
OjectId newId= pwc.checkIn(false, propertiesMap, contentStream, "minor version");
if(newId!=null){
return newId.getId() ;
}
}
} catch (Exception e) {
try{
if(pwc!=null)
pwc.cancelCheckOut();
LogUtility.logError(info, "checkout is cancelled", e) ;
}
catch(Throwable t){LogUtility.logError(info, "Failed to cancel checkout", e); }
throw e ;
}