boolean resolvableInTargetWorkspace = targetCache.getNode(referenceInTargetKey) != null;
boolean resolvableInSourceWorkspace = sourceCache.getNode(referenceInSourceKey) != null;
if (!resolvableInTargetWorkspace && resolvableInSourceWorkspace) {
// it's not resolvable in the target but it's resolvable in the source, so the clone/copy graph is not
// reference-isolated
throw new WrappedException(
new RepositoryException(
JcrI18n.cannotCopyOrCloneReferenceOutsideGraph.text(propertyName,
referenceInSourceKey,
startingPathInSource)));
} else if (!resolvableInSourceWorkspace && !referenceInSource.isWeak() && !referenceInSource.isSimple()) {
// it's a non resolvable strong reference, meaning it's corrupt
throw new WrappedException(
new RepositoryException(
JcrI18n.cannotCopyOrCloneCorruptReference.text(propertyName,
referenceInSourceKey)));
}
}