]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaw 588/head
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 20 Oct 2015 08:41:46 +0000 (10:41 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 20 Oct 2015 08:59:38 +0000 (10:59 +0200)
server/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java

index b4933b6871e0e595419d335f65f35208ae17df7f..449c52b775877d86941ef68462a11e80d2f30158 100644 (file)
@@ -140,6 +140,7 @@ public class RuleMapping extends BaseMapping<RuleDoc, RuleMappingContext> {
     setParams(ruleResponse, ruleDoc, fieldsToReturn);
     setCreatedAt(ruleResponse, ruleDoc, fieldsToReturn);
     setDescriptionFields(ruleResponse, ruleDoc, fieldsToReturn);
+    setNotesFields(ruleResponse, ruleDoc, fieldsToReturn);
     setSeverity(ruleResponse, ruleDoc, fieldsToReturn);
     setInternalKey(ruleResponse, ruleDoc, fieldsToReturn);
     setLanguage(ruleResponse, ruleDoc, fieldsToReturn);
@@ -291,15 +292,18 @@ public class RuleMapping extends BaseMapping<RuleDoc, RuleMappingContext> {
         ruleResponse.setHtmlDesc(macroInterpreter.interpret(ruleDoc.htmlDescription()));
       }
     }
+    if (shouldReturnField(fieldsToReturn, RuleNormalizer.RuleField.MARKDOWN_DESCRIPTION) && ruleDoc.markdownDescription() != null) {
+      ruleResponse.setMdDesc(ruleDoc.markdownDescription());
+    }
+  }
+
+  private void setNotesFields(Rules.Rule.Builder ruleResponse, Rule ruleDoc, Set<String> fieldsToReturn) {
     if (shouldReturnField(fieldsToReturn, "htmlNote") && ruleDoc.markdownNote() != null) {
       ruleResponse.setHtmlNote(macroInterpreter.interpret(Markdown.convertToHtml(ruleDoc.markdownNote())));
     }
     if (shouldReturnField(fieldsToReturn, "mdNote") && ruleDoc.markdownNote() != null) {
       ruleResponse.setMdNote(ruleDoc.markdownNote());
     }
-    if (shouldReturnField(fieldsToReturn, RuleNormalizer.RuleField.MARKDOWN_DESCRIPTION) && ruleDoc.markdownDescription() != null) {
-      ruleResponse.setMdDesc(ruleDoc.markdownDescription());
-    }
     if (shouldReturnField(fieldsToReturn, RuleNormalizer.RuleField.NOTE_LOGIN) && ruleDoc.noteLogin() != null) {
       ruleResponse.setNoteLogin(ruleDoc.noteLogin());
     }