Correct usage of RepositoryNotFoundException

This commit is contained in:
René Pfeuffer
2018-09-10 08:36:05 +02:00
parent eff51c3b37
commit 9198cac0a5
4 changed files with 9 additions and 7 deletions

View File

@@ -210,8 +210,9 @@ public class PermissionRootResource {
* @throws RepositoryNotFoundException if the repository does not exists
*/
private Repository load(String namespace, String name) throws RepositoryNotFoundException {
return Optional.ofNullable(manager.get(new NamespaceAndName(namespace, name)))
.orElseThrow(() -> new RepositoryNotFoundException(name));
NamespaceAndName namespaceAndName = new NamespaceAndName(namespace, name);
return Optional.ofNullable(manager.get(namespaceAndName))
.orElseThrow(() -> new RepositoryNotFoundException(namespaceAndName));
}
/**