]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8740 do not open SQL session if user is not logged in
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 3 Feb 2017 08:46:45 +0000 (09:46 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 7 Feb 2017 09:27:24 +0000 (10:27 +0100)
server/sonar-server/src/main/java/org/sonar/server/favorite/ws/SearchAction.java

index 0f2cc957a82f99abe556612e2e71fa4ec13839b5..64bc9e8a7ad5c696f52b892be5a16e19c283633d 100644 (file)
@@ -89,9 +89,9 @@ public class SearchAction implements FavoritesWsAction {
   }
 
   private SearchResults search(SearchRequest request) {
+    userSession.checkLoggedIn();
     try (DbSession dbSession = dbClient.openSession(false)) {
       return Stream.of(request)
-        .peek(r -> userSession.checkLoggedIn())
         .map(SearchResults.builder(dbSession))
         .peek(this::addAuthorizedProjectUuids)
         .peek(this::addFavorites)