mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.4 to HEAD (fix for ALF-6558)
23466: Attach causal exception for DuplicateChildNodeNameException (ALF-5488, ALF-5540) - Also add savepoints around these updates statements - Propagate exception so that we can identify if something else (not duplicate child name) is at fault git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24837 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1069,7 +1069,8 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
throw new DuplicateChildNodeNameException(
|
throw new DuplicateChildNodeNameException(
|
||||||
newParentNode.getNodeRef(),
|
newParentNode.getNodeRef(),
|
||||||
assocTypeQName,
|
assocTypeQName,
|
||||||
childNodeName);
|
childNodeName,
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2245,17 +2246,22 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
{
|
{
|
||||||
public Long execute() throws Throwable
|
public Long execute() throws Throwable
|
||||||
{
|
{
|
||||||
|
Savepoint savepoint = controlDAO.createSavepoint("DuplicateChildNodeNameException");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return insertChildAssoc(assoc);
|
Long id = insertChildAssoc(assoc);
|
||||||
|
controlDAO.releaseSavepoint(savepoint);
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
|
controlDAO.rollbackToSavepoint(savepoint);
|
||||||
// We assume that this is from the child cm:name constraint violation
|
// We assume that this is from the child cm:name constraint violation
|
||||||
throw new DuplicateChildNodeNameException(
|
throw new DuplicateChildNodeNameException(
|
||||||
parentNode.getNodeRef(),
|
parentNode.getNodeRef(),
|
||||||
assocTypeQName,
|
assocTypeQName,
|
||||||
childNodeName);
|
childNodeName,
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2335,14 +2341,18 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
{
|
{
|
||||||
public Integer execute() throws Throwable
|
public Integer execute() throws Throwable
|
||||||
{
|
{
|
||||||
|
Savepoint savepoint = controlDAO.createSavepoint("DuplicateChildNodeNameException");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return updateChildAssocsUniqueName(childNodeId, childName);
|
Integer count = updateChildAssocsUniqueName(childNodeId, childName);
|
||||||
|
controlDAO.releaseSavepoint(savepoint);
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
|
controlDAO.rollbackToSavepoint(savepoint);
|
||||||
// We assume that this is from the child cm:name constraint violation
|
// We assume that this is from the child cm:name constraint violation
|
||||||
throw new DuplicateChildNodeNameException(null, null, childName);
|
throw new DuplicateChildNodeNameException(null, null, childName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -38,9 +38,9 @@ public class DuplicateChildNodeNameException extends RuntimeException
|
|||||||
private QName assocTypeQName;
|
private QName assocTypeQName;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public DuplicateChildNodeNameException(NodeRef parentNodeRef, QName assocTypeQName, String name)
|
public DuplicateChildNodeNameException(NodeRef parentNodeRef, QName assocTypeQName, String name, Throwable e)
|
||||||
{
|
{
|
||||||
super(I18NUtil.getMessage(ERR_DUPLICATE_NAME, name));
|
super(I18NUtil.getMessage(ERR_DUPLICATE_NAME, name), e);
|
||||||
this.parentNodeRef = parentNodeRef;
|
this.parentNodeRef = parentNodeRef;
|
||||||
this.assocTypeQName = assocTypeQName;
|
this.assocTypeQName = assocTypeQName;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
Reference in New Issue
Block a user