From c699bdd89cd60664d14d32fa098335346ea59034 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 10 Jul 2017 16:16:05 +0200 Subject: [PATCH] SONAR-9488 don't open DB connection when file is missing in api/qualityprofiles/restore --- .../java/org/sonar/server/qualityprofile/ws/RestoreAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.5