diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-02-04 17:25:38 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-02-04 17:25:38 +0100 |
commit | 7db29fdd2081290ae1a8bafdc475d30e3692adbb (patch) | |
tree | e9e49c633b4532a25d9b44e8f27d4236b440149e /sonar-server | |
parent | b2885e93ebd9e6042d9b3f7281c2ddc0ad91a949 (diff) | |
download | sonarqube-7db29fdd2081290ae1a8bafdc475d30e3692adbb.tar.gz sonarqube-7db29fdd2081290ae1a8bafdc475d30e3692adbb.zip |
SONAR-4785 Fail if rule has no name and issue has no message
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java b/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java index 2e867856953..1fa32a29f6a 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowWsHandler.java @@ -100,6 +100,7 @@ public class IssueShowWsHandler implements RequestHandler { Component component = result.component(issue); Component project = result.project(issue); String actionPlanKey = issue.actionPlanKey(); + ActionPlan actionPlan = result.actionPlan(issue); WorkDayDuration technicalDebt = issue.technicalDebt(); Date updateDate = issue.updateDate(); Date closeDate = issue.closeDate(); @@ -120,8 +121,8 @@ public class IssueShowWsHandler implements RequestHandler { .prop("severity", issue.severity()) .prop("author", issue.authorLogin()) .prop("actionPlan", actionPlanKey) + .prop("actionPlanName", actionPlan != null ? actionPlan.name() : null) .prop("debt", technicalDebt != null ? debtFormatter.format(UserSession.get().locale(), technicalDebt) : null) - .prop("actionPlanName", actionPlanKey != null ? result.actionPlan(issue).name() : null) .prop("creationDate", DateUtils.formatDateTime(issue.creationDate())) .prop("fCreationDate", formatDate(issue.creationDate())) .prop("updateDate", updateDate != null ? DateUtils.formatDateTime(updateDate) : null) @@ -138,7 +139,7 @@ public class IssueShowWsHandler implements RequestHandler { private void addCharacteristics(IssueQueryResult result, DefaultIssue issue, JsonWriter json) { Characteristic requirement = technicalDebtManager.findRequirementByRule(result.rule(issue)); // Requirement can be null if it has been disabled - if (requirement != null) { + if (requirement != null && requirement.rootId() != null && requirement.parentId() != null) { Characteristic characteristic = technicalDebtManager.findCharacteristicById(requirement.rootId()); json.prop("characteristic", characteristic != null ? characteristic.name() : null); Characteristic subCharacteristic = technicalDebtManager.findCharacteristicById(requirement.parentId()); @@ -194,15 +195,16 @@ public class IssueShowWsHandler implements RequestHandler { String login = UserSession.get().login(); for (IssueComment comment : issue.comments()) { String userLogin = comment.userLogin(); + User user = userLogin != null ? queryResult.user(userLogin) : null; json .beginObject() .prop("key", comment.key()) - .prop("userName", userLogin != null ? queryResult.user(userLogin).name() : null) + .prop("userName", user != null ? user.name() : null) .prop("raw", comment.markdownText()) .prop("html", Markdown.convertToHtml(comment.markdownText())) .prop("createdAt", DateUtils.formatDateTime(comment.createdAt())) .prop("fCreatedAge", formatAgeDate(comment.createdAt())) - .prop("updatable", login != null && login.equals(comment.userLogin())) + .prop("updatable", login != null && login.equals(userLogin)) .endObject(); } json.endArray(); |