From: Teryk Bellahsene Date: Thu, 12 Oct 2017 11:38:17 +0000 (+0200) Subject: SONAR-7734 Clarify message when one of several parameters is required X-Git-Tag: 6.7-RC1~278 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7ee2cc6372f66afc24e0fd4f780bab8dfcdb4409;p=sonarqube.git SONAR-7734 Clarify message when one of several parameters is required --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java index 0f109ec370a..289b0cd480e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java @@ -40,7 +40,6 @@ import org.sonarqube.ws.WsCe.ProjectResponse; import static org.sonar.db.Pagination.forPage; import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY; import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT; import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; @@ -63,8 +62,8 @@ public class ComponentAction implements CeWsAction { WebService.NewAction action = controller.createAction("component") .setDescription("Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).
" + "Requires the following permission: 'Browse' on the specified component.
" + - "Either '%s' or '%s' must be provided, not both.", - PARAM_COMPONENT_ID, DEPRECATED_PARAM_COMPONENT_KEY) + "Either '%s' or '%s' must be provided.", + PARAM_COMPONENT_ID, PARAM_COMPONENT) .setSince("5.2") .setResponseExample(getClass().getResource("component-example.json")) .setChangelog( diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentFinder.java b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentFinder.java index cb191f65287..384aa88a2e8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentFinder.java @@ -40,7 +40,7 @@ import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; import static org.sonar.server.ws.WsUtils.checkRequest; public class ComponentFinder { - private static final String MSG_COMPONENT_ID_OR_KEY_TEMPLATE = "Either '%s' or '%s' must be provided, not both"; + private static final String MSG_COMPONENT_ID_OR_KEY_TEMPLATE = "Either '%s' or '%s' must be provided"; private static final String MSG_PARAMETER_MUST_NOT_BE_EMPTY = "The '%s' parameter must not be empty"; private static final String LABEL_PROJECT = "Project"; private static final String LABEL_COMPONENT = "Component"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java index 568b92490af..0453dfcc850 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java @@ -147,7 +147,7 @@ public class CreateAction implements CustomMeasuresWsAction { private MetricDto searchMetric(DbSession dbSession, Request request) { Integer metricId = request.paramAsInt(PARAM_METRIC_ID); String metricKey = request.param(PARAM_METRIC_KEY); - checkArgument(metricId != null ^ metricKey != null, "The metric id or the metric key must be provided, not both."); + checkArgument(metricId != null ^ metricKey != null, "Either the metric id or the metric key must be provided"); if (metricId != null) { return dbClient.metricDao().selectOrFailById(dbSession, metricId); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ProjectWsRef.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ProjectWsRef.java index 02bcb3d3025..5a3cad31e6a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ProjectWsRef.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ProjectWsRef.java @@ -51,7 +51,6 @@ public class ProjectWsRef { } public static ProjectWsRef newWsProjectRef(@Nullable String uuid, @Nullable String key) { - checkRequest(uuid == null ^ key == null, MSG_ID_OR_KEY_MUST_BE_PROVIDED); return new ProjectWsRef(uuid, key); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java index 106a9db3a6c..017a6ec373b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java @@ -80,7 +80,7 @@ public class BulkUpdateKeyAction implements ProjectsWsAction { "
  • %s: my_
  • " + "
  • %s: my_new_
  • " + "" + - "Either '%s' or '%s' must be provided, not both.
    " + + "Either '%s' or '%s' must be provided.
    " + "Requires one of the following permissions: " + "