From: Sébastien Lesaint Date: Mon, 10 Jul 2017 14:16:05 +0000 (+0200) Subject: SONAR-9488 don't open DB connection when file is missing X-Git-Tag: 6.6-RC1~860 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c699bdd89cd60664d14d32fa098335346ea59034;p=sonarqube.git SONAR-9488 don't open DB connection when file is missing in api/qualityprofiles/restore --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java index 44f977f87bc..4c8f3e6e96a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java @@ -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);