From: Stephane Gamard Date: Tue, 1 Jul 2014 15:03:29 +0000 (+0200) Subject: fix quality flaws (sort field can be null) X-Git-Tag: 4.4-RC1~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2bcc5db2cf35728339ce08fe32ff4b7063d3a4ce;p=sonarqube.git fix quality flaws (sort field can be null) --- diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java index 944576127be..06e3334574e 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java @@ -234,13 +234,17 @@ public class SearchAction implements RequestHandler { query.setHasDebtCharacteristic(request.paramAsBoolean(PARAM_HAS_DEBT_CHARACTERISTIC)); query.setActivation(request.paramAsBoolean(PARAM_ACTIVATION)); query.setQProfileKey(request.param(PARAM_QPROFILE)); - query.setSortField(RuleNormalizer.RuleField.of(request.param(SearchOptions.PARAM_SORT))); - query.setAscendingSort(request.mandatoryParamAsBoolean(SearchOptions.PARAM_ASCENDING)); query.setTags(request.paramAsStrings(PARAM_TAGS)); query.setInheritance(request.paramAsStrings(PARAM_INHERITANCE)); query.setIsTemplate(request.paramAsBoolean(PARAM_IS_TEMPLATE)); query.setTemplateKey(request.param(PARAM_TEMPLATE_KEY)); query.setKey(request.param(PARAM_KEY)); + + String sortParam = request.param(SearchOptions.PARAM_SORT); + if (sortParam != null) { + query.setSortField(RuleNormalizer.RuleField.of(sortParam)); + query.setAscendingSort(request.mandatoryParamAsBoolean(SearchOptions.PARAM_ASCENDING)); + } return query; }