]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9488 don't open DB connection when file is missing 2232/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 10 Jul 2017 14:16:05 +0000 (16:16 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 21 Jul 2017 10:20:52 +0000 (12:20 +0200)
in api/qualityprofiles/restore

server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java

index 44f977f87bc6060f9473b0d76b892a1e9a4d2dad..4c8f3e6e96a7f9a29c708059b54213dfeb91fb3d 100644 (file)
@@ -83,11 +83,11 @@ public class RestoreAction implements QProfileWsAction {
     userSession.checkLoggedIn();
 
     InputStream backup = request.paramAsInputStream(PARAM_BACKUP);
+    checkArgument(backup != null, "A backup file must be provided");
     String organizationKey = request.param(PARAM_ORGANIZATION);
     InputStreamReader reader = null;
 
     try (DbSession dbSession = dbClient.openSession(false)) {
-      checkArgument(backup != null, "A backup file must be provided");
       reader = new InputStreamReader(backup, UTF_8);
 
       OrganizationDto organization = wsSupport.getOrganizationByKey(dbSession, organizationKey);