AnsweredAssumed Answered

OpenCMIS cancelCheckout still createing an new version

Question asked by bbwang on Mar 13, 2013
Latest reply on Mar 18, 2013 by jpotts
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 ;
}

Outcomes