Hi,I am using AtomPub URI to load documents to Alfresco. The code is working good, however when trying to load same document again I am getting "CmisConstraintException" instead of "CmisContentAlreadyExistsException". All the examples online are using "CmisContentAlreadyExistsException" and it would be great if i get the same so that I can take the count of documents already available. Kindly let me know what needs to be done to get "CmisContentAlreadyExistsException". My code is given below. Thanks in advance.
try {
contentStream = session.getObjectFactory().
createContentStream(
sFileName,
file.length(),
sfileType,
new FileInputStream(file)
);
Folder folder = (Folder) session.getObjectByPath(sTargetSpaceName);
//document = folder.createDocument(props, contentStream, null);
document = folder.createDocument(props, contentStream, null);
//System.out.println("Created new document in Alfresco for: " + sFileName + ": " + document.getId());
System.out.println("Created new document in Alfresco for: " + sFileName);
} catch (CmisContentAlreadyExistsException ccaee) {
System.out.println("ERROR: Unable to Load - CmisContentAlreadyExistsException: " + sFileName);
} catch (CmisConstraintException cce) {
System.out.println("ERROR: Unable to Load - CmisConstraintException: " + sFileName);
}