ConstraintViolationException, ItemNotFoundException, LockException,
RepositoryException {
Path.PathElement insertName;
try {
Path p = PathFormat.parse(srcName, session.getNamespaceResolver());
// p must be a relative path of length==depth==1 (to eliminate e.g. "..")
if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
throw new RepositoryException("invalid name: " + srcName);
}
insertName = p.getNameElement();
} catch (MalformedPathException e) {
String msg = "invalid name: " + srcName;
log.debug(msg);
throw new RepositoryException(msg, e);
}
Path.PathElement beforeName;
if (destName != null) {
try {
Path p = PathFormat.parse(destName, session.getNamespaceResolver());
// p must be a relative path of length==depth==1 (to eliminate e.g. "..")
if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
throw new RepositoryException("invalid name: " + destName);
}
beforeName = p.getNameElement();
} catch (MalformedPathException e) {
String msg = "invalid name: " + destName;
log.debug(msg);
throw new RepositoryException(msg, e);
}