aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-08-05 21:39:01 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-08-05 21:39:01 +0200
commitc4958011d0e2e59aa8a79509b59a05878bd8dab2 (patch)
tree275f4c38854a62d0cdc8f1ac5a515ec0d8067108 /server
parente518e7cde4b3583df1978ac70fc03195784bb5f2 (diff)
downloadsonarqube-c4958011d0e2e59aa8a79509b59a05878bd8dab2.tar.gz
sonarqube-c4958011d0e2e59aa8a79509b59a05878bd8dab2.zip
Do not set some empty string fields in api/issues response
- assignee - resolution - reporter - actionPlanKey
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
index 073f7af942f..558e70b1165 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
@@ -150,7 +150,6 @@ public class SearchResponseFormat {
issueBuilder.setComponent(dto.getComponentKey());
// Only used for the compatibility with the Java WS Client <= 4.4 used by Eclipse
issueBuilder.setComponentId(component.getId());
-
ComponentDto project = data.getComponentByUuid(dto.getProjectUuid());
if (project != null) {
issueBuilder.setProject(project.getKey());
@@ -161,11 +160,19 @@ public class SearchResponseFormat {
}
issueBuilder.setRule(dto.getRuleKey().toString());
issueBuilder.setSeverity(Common.Severity.valueOf(dto.getSeverity()));
- issueBuilder.setAssignee(nullToEmpty(dto.getAssignee()));
- issueBuilder.setReporter(nullToEmpty(dto.getReporter()));
- issueBuilder.setResolution(nullToEmpty(dto.getResolution()));
- issueBuilder.setStatus(nullToEmpty(dto.getStatus()));
- issueBuilder.setActionPlan(nullToEmpty(dto.getActionPlanKey()));
+ if (!Strings.isNullOrEmpty(dto.getAssignee())) {
+ issueBuilder.setAssignee(dto.getAssignee());
+ }
+ if (!Strings.isNullOrEmpty(dto.getReporter())) {
+ issueBuilder.setReporter(dto.getReporter());
+ }
+ if (!Strings.isNullOrEmpty(dto.getResolution())) {
+ issueBuilder.setResolution(dto.getResolution());
+ }
+ issueBuilder.setStatus(dto.getStatus());
+ if (!Strings.isNullOrEmpty(dto.getActionPlanKey())) {
+ issueBuilder.setActionPlan(dto.getActionPlanKey());
+ }
issueBuilder.setMessage(nullToEmpty(dto.getMessage()));
issueBuilder.setTagsPresentIfEmpty(true);
issueBuilder.addAllTags(dto.getTags());