From 2bcc5db2cf35728339ce08fe32ff4b7063d3a4ce Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Tue, 1 Jul 2014 17:03:29 +0200 Subject: [PATCH] fix quality flaws (sort field can be null) --- .../main/java/org/sonar/server/rule/ws/SearchAction.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.39.5