From a42510b9e77d6ba9938f0d578e3b0253a136e4e1 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 4 Feb 2014 15:52:19 +0100 Subject: [PATCH] Revert SONAR-4785 --- .../server/issue/ws/IssueShowWsHandler.java | 6 ++--- .../app/controllers/api/issues_controller.rb | 2 +- .../main/webapp/WEB-INF/app/models/issue.rb | 4 +-- .../widgets/issues/_issues_list.html.erb | 3 +-- .../issue/ws/IssueShowWsHandlerTest.java | 14 ----------- ...ow_issue_display_name_when_no_message.json | 25 ------------------- .../show_issue_on_removed_component.json | 1 - ...ssue_on_removed_project_and_component.json | 1 - .../show_issue_with_action_plan.json | 1 - .../show_issue_with_actions.json | 1 - ...issue_with_actions_defined_by_plugins.json | 1 - .../show_issue_with_assign_to_me_action.json | 1 - .../show_issue_with_changelog.json | 1 - .../show_issue_with_characteristics.json | 1 - .../show_issue_with_comments.json | 1 - .../show_issue_with_dates.json | 1 - .../show_issue_with_set_severity_action.json | 1 - .../show_issue_with_technical_debt.json | 1 - .../show_issue_with_transitions.json | 1 - .../show_issue_with_users.json | 1 - ...how_issue_without_assign_to_me_action.json | 1 - 21 files changed, 6 insertions(+), 63 deletions(-) delete mode 100644 sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_display_name_when_no_message.json 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 4bd8a1f7979..2e867856953 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 @@ -97,8 +97,6 @@ public class IssueShowWsHandler implements RequestHandler { } private void writeIssue(IssueQueryResult result, DefaultIssue issue, JsonWriter json) { - String message = issue.message(); - String ruleName = result.rule(issue).getName(); Component component = result.component(issue); Component project = result.project(issue); String actionPlanKey = issue.actionPlanKey(); @@ -114,9 +112,9 @@ public class IssueShowWsHandler implements RequestHandler { .prop("project", issue.projectKey()) .prop("projectLongName", project != null ? project.longName() : null) .prop("rule", issue.ruleKey().toString()) - .prop("ruleName", ruleName) + .prop("ruleName", result.rule(issue).getName()) .prop("line", issue.line()) - .prop("message", message != null ? message : ruleName) + .prop("message",issue.message()) .prop("resolution", issue.resolution()) .prop("status", issue.status()) .prop("severity", issue.severity()) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb index 7a935b0cbae..7aa39a5161d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb @@ -32,7 +32,7 @@ class Api::IssuesController < Api::ApiController hash = { :maxResultsReached => results.maxResultsReached, :paging => paging_to_hash(results.paging), - :issues => results.issues.map { |issue| Issue.to_hash(issue, results.rule(issue).name) }, + :issues => results.issues.map { |issue| Issue.to_hash(issue) }, :components => results.components.map { |component| component_to_hash(component) }, :projects => results.projects.map { |project| component_to_hash(project) }, :rules => results.rules.map { |rule| Rule.to_hash(rule) }, diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb index a3a34a3dd5d..c1d6e2d35ac 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb @@ -20,7 +20,7 @@ class Issue - def self.to_hash(issue, rule_name=nil) + def self.to_hash(issue) hash = { :key => issue.key, :component => issue.componentKey, @@ -30,7 +30,7 @@ class Issue } hash[:resolution] = issue.resolution if issue.resolution hash[:severity] = issue.severity if issue.severity - hash[:message] = issue.message ? issue.message : rule_name + hash[:message] = issue.message if issue.message hash[:line] = issue.line.to_i if issue.line hash[:effortToFix] = issue.effortToFix.to_f if issue.effortToFix hash[:technicalDebt] = technical_debt_to_hash(issue.technicalDebt) if issue.technicalDebt diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb index c6ce6bfe901..e3dbd405fe4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb @@ -38,8 +38,7 @@ - - <%= h truncate(issue.message ? issue.message : results.rule(issue).name, :length => 100) -%> + <%= h truncate(issue.message, :length => 100) -%> <% if last_comment %>
diff --git a/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java b/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java index c8337a87279..aa2ec681d0b 100644 --- a/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java +++ b/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowWsHandlerTest.java @@ -402,19 +402,6 @@ public class IssueShowWsHandlerTest { request.execute().assertJson(getClass(), "show_issue_with_changelog.json"); } - /** - * SONAR-4785 - */ - @Test - public void show_issue_display_name_when_no_message() throws Exception { - Issue issue = createStandardIssue().setMessage(null); - issues.add(issue); - - MockUserSession.set(); - WsTester.TestRequest request = tester.newRequest("show").setParam("key", issue.key()); - request.execute().assertJson(getClass(), "show_issue_display_name_when_no_message.json"); - } - private DefaultIssue createStandardIssue() { DefaultIssue issue = createIssue(); addComponentAndProject(); @@ -424,7 +411,6 @@ public class IssueShowWsHandlerTest { private DefaultIssue createIssue() { return new DefaultIssue() .setKey("ABCD") - .setMessage("Fix it") .setComponentKey("org.sonar.server.issue.IssueClient") .setProjectKey("org.sonar.Sonar") .setRuleKey(RuleKey.of("squid", "AvoidCycle")) diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_display_name_when_no_message.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_display_name_when_no_message.json deleted file mode 100644 index 9865380f248..00000000000 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_display_name_when_no_message.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "issue": { - "key": "ABCD", - "component": "org.sonar.server.issue.IssueClient", - "componentLongName": "SonarQube :: Issue Client", - "componentQualifier": "FIL", - "project": "org.sonar.Sonar", - "projectLongName": "SonarQube", - "rule": "squid:AvoidCycle", - "ruleName": "Avoid cycle", - "message": "Avoid cycle", - "creationDate": "2014-01-22T19:10:03+0100", - "fCreationDate": "Jan 22, 2014 10:03 AM", - "transitions": [], - "actions": [], - "comments": [], - "changelog": [ - { - "creationDate": "2014-01-22T19:10:03+0100", - "fCreationDate": "Jan 22, 2014 10:03 AM", - "diffs": ["Created"] - } - ] - } -} diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_component.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_component.json index 0391e0c6e8d..1f6563e1eac 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_component.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_component.json @@ -6,7 +6,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", "transitions": [], diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_project_and_component.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_project_and_component.json index 654ae679c04..74542d5ed0e 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_project_and_component.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_on_removed_project_and_component.json @@ -5,7 +5,6 @@ "project": "org.sonar.Sonar", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", "transitions": [], diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json index dead025099c..49f7db8f8c0 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_action_plan.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "actionPlan" : "AP-ABCD", "actionPlanName" : "Version 4.2", "creationDate": "2014-01-22T19:10:03+0100", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json index 14ceb5051cb..011a92460cb 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "status": "OPEN", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json index 0eed8b5cfcf..1b75cbc5b7c 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_actions_defined_by_plugins.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "status": "OPEN", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json index 14ceb5051cb..011a92460cb 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_assign_to_me_action.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "status": "OPEN", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json index 41349ce3d45..35bc7c3ef59 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_changelog.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", "transitions": [], diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json index 41f351d840a..373ad27273c 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_characteristics.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "characteristic": "Maintainability", "subCharacteristic": "Readability", "creationDate": "2014-01-22T19:10:03+0100", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json index 1e3a73b1c31..1e863053a9b 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_comments.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", "transitions": [], diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json index e08fdd0f33c..67db98ec7c1 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_dates.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", "updateDate": "2014-01-23T19:10:03+0100", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json index 60e5aeb58bb..9e2ce2a3daa 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_set_severity_action.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "status": "OPEN", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json index 792e26128fa..f938630cfaa 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_technical_debt.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "debt": "2 hours 1 minutes", "creationDate": "2014-01-22T19:10:03+0100", "fCreationDate": "Jan 22, 2014 10:03 AM", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json index 2b0bda3f4d3..d7646909a37 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_transitions.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "status": "RESOLVED", "resolution": "FIXED", "creationDate": "2014-01-22T19:10:03+0100", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json index f7c249e1ed5..f26e887d9d6 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_with_users.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "assignee": "john", "assigneeName": "John", "reporter": "steven", diff --git a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json index 93a38a2da05..4adcdc4d533 100644 --- a/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json +++ b/sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowWsHandlerTest/show_issue_without_assign_to_me_action.json @@ -8,7 +8,6 @@ "projectLongName": "SonarQube", "rule": "squid:AvoidCycle", "ruleName": "Avoid cycle", - "message": "Fix it", "assignee": "john", "assigneeName": "John", "status": "OPEN", -- 2.39.5