Improve the exception if you try to check out an older version of the document

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34369 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2012-03-02 16:27:28 +00:00
parent 840440764b
commit 2b3a580338

View File

@@ -1769,10 +1769,17 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
// check for current version
if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION))
// Check for current version
if (info.isVariant(CMISObjectVariant.CURRENT_VERSION))
{
throw new CmisInvalidArgumentException("Only documents can be checked out!");
// Good
}
else if (info.isVariant(CMISObjectVariant.VERSION))
{
throw new CmisInvalidArgumentException("Can't check out an old version of a document");
}
else {
throw new CmisInvalidArgumentException("Only documents can be checked out! Object was a " + info.getObjectVariant().toString());
}
// get object