Commits

Sebastian Sdorra committed 4f8147a

use only configured handlers

  • Participants
  • Parent commits 89db19c

Comments (0)

Files changed (1)

File scm-core/src/main/java/sonia/scm/repository/BasicRepositoryManager.java

 
     for (RepositoryHandler handler : handlerMap.values())
     {
-      repository = handler.get(id);
+      if (handler.isConfigured())
+      {
+        repository = handler.get(id);
 
-      if (repository != null)
-      {
-        break;
+        if (repository != null)
+        {
+          break;
+        }
       }
     }
 
 
     for (RepositoryHandler handler : handlerMap.values())
     {
-      Collection<Repository> handlerRepositories = handler.getAll();
+      if (handler.isConfigured())
+      {
+        Collection<Repository> handlerRepositories = handler.getAll();
 
-      if (handlerRepositories != null)
-      {
-        repositories.addAll(handlerRepositories);
+        if (handlerRepositories != null)
+        {
+          repositories.addAll(handlerRepositories);
+        }
       }
     }
 
    *
    * @return
    *
-   * @throws RepositoryHandlerNotFoundException
+   *
+   * @throws RepositoryException
    */
   private RepositoryHandler getHandler(Repository repository)
-          throws RepositoryHandlerNotFoundException
+          throws RepositoryException
   {
     String type = repository.getType();
     RepositoryHandler handler = handlerMap.get(type);
       throw new RepositoryHandlerNotFoundException(
           "could not find handler for ".concat(type));
     }
+    else if (!handler.isConfigured())
+    {
+      throw new RepositoryException("handler is not configured");
+    }
 
     return handler;
   }