diff options
author | Aurelien Poscia <aurelien.poscia@sonarsource.com> | 2022-05-25 11:53:18 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-05-25 20:03:17 +0000 |
commit | 947467d1f1c31c0481dae328b45cda5579d79f14 (patch) | |
tree | 493273cadd22230b1029514c0c214937191374ec /server | |
parent | 590abc5e05b4b354b29bec2d93543aa00ab48ccf (diff) | |
download | sonarqube-947467d1f1c31c0481dae328b45cda5579d79f14.tar.gz sonarqube-947467d1f1c31c0481dae328b45cda5579d79f14.zip |
SONAR-16397 Hotspot API: return default section in 'riskDescription' field instead of 'vulnerabilityDescription'
Diffstat (limited to 'server')
2 files changed, 3 insertions, 3 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java index 0658ce71649..44d5df3186f 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java @@ -182,7 +182,7 @@ public class ShowAction implements HotspotsWsAction { .setVulnerabilityProbability(sqCategory.getVulnerability().name()); Map<String, String> sectionKeyToContent = getSectionKeyToContent(ruleDto); - Optional.ofNullable(sectionKeyToContent.get(DEFAULT_KEY)).ifPresent(ruleBuilder::setVulnerabilityDescription); + Optional.ofNullable(sectionKeyToContent.get(DEFAULT_KEY)).ifPresent(ruleBuilder::setRiskDescription); Optional.ofNullable(sectionKeyToContent.get(ROOT_CAUSE_SECTION_KEY)).ifPresent(ruleBuilder::setVulnerabilityDescription); Optional.ofNullable(sectionKeyToContent.get(ASSESS_THE_PROBLEM_SECTION_KEY)).ifPresent(ruleBuilder::setRiskDescription); Optional.ofNullable(sectionKeyToContent.get(HOW_TO_FIX_SECTION_KEY)).ifPresent(ruleBuilder::setFixRecommendations); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java index 7e4146efb2c..1cc2d5d8a0c 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java @@ -488,8 +488,8 @@ public class ShowActionTest { Hotspots.ShowWsResponse response = newRequest(hotspot) .executeProtobuf(Hotspots.ShowWsResponse.class); - assertThat(response.getRule().getVulnerabilityDescription()).isEqualTo(introductionSection.getContent()); - assertThat(response.getRule().getRiskDescription()).isEmpty(); + assertThat(response.getRule().getRiskDescription()).isEqualTo(introductionSection.getContent()); + assertThat(response.getRule().getVulnerabilityDescription()).isEmpty(); assertThat(response.getRule().getFixRecommendations()).isEmpty(); } |