aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-10 11:01:33 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-10 11:08:31 +0200
commit2d64ed77a76237c88103b853a5dc70d96a1ad77a (patch)
tree477df0c8399c2f122df371efac839f8755d2dc1d
parent7445dff59d3dbfbb590823cd1140ede3d63fded1 (diff)
downloadsonarqube-2d64ed77a76237c88103b853a5dc70d96a1ad77a.tar.gz
sonarqube-2d64ed77a76237c88103b853a5dc70d96a1ad77a.zip
SONAR-6305 Fix parameter description and quality flaw
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileRestoreAction.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileRestoreAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileRestoreAction.java
index da33e1eeac6..8b4634b4ee0 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileRestoreAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileRestoreAction.java
@@ -51,19 +51,23 @@ public class QProfileRestoreAction implements BaseQProfileWsAction {
.setHandler(this)
.createParam(PARAM_BACKUP)
.setDescription("A profile backup file in XML format, as generated by api/qualityprofiles/backup " +
- "or the former api/profiles/backup.");
+ "or the former api/profiles/backup.")
+ .setRequired(true);
}
@Override
public void handle(Request request, Response response) throws Exception {
UserSession.get().checkLoggedIn().checkGlobalPermission(GlobalPermissions.QUALITY_PROFILE_ADMIN);
InputStream backup = request.paramAsInputStream(PARAM_BACKUP);
+ InputStreamReader reader = null;
+
try {
Preconditions.checkArgument(backup != null, "A backup file must be provided");
-
- backuper.restore(new InputStreamReader(backup, Charsets.UTF_8), null);
+ reader = new InputStreamReader(backup, Charsets.UTF_8);
+ backuper.restore(reader, null);
response.noContent();
} finally {
+ IOUtils.closeQuietly(reader);
IOUtils.closeQuietly(backup);
}
}