}
try {
new URI(uri);
} catch (URISyntaxException e) {
throw new InvalidURIException("Invalid URI; error: " + e.getMessage());
}
if (getRepository().containsResource(uri)) {
throw new DuplicateURIException(
"Attempt to create a repository with a URI that already exists: " + uri);