diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-10-15 16:48:38 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-10-15 16:48:38 +0200 |
commit | cd1de0a69ab51a45fba719fe6a665ed938c5e441 (patch) | |
tree | 984d4c9a381d478a5e3fa9c4692a0d696061e7af /sonar-ws-client | |
parent | e25ed9de489856345748d0e45935219b83374818 (diff) | |
download | sonarqube-cd1de0a69ab51a45fba719fe6a665ed938c5e441.tar.gz sonarqube-cd1de0a69ab51a45fba719fe6a665ed938c5e441.zip |
Fix quality flaws
Diffstat (limited to 'sonar-ws-client')
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java | 11 | ||||
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java index d5c6fa201f0..9640d2520fc 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/IssueJsonParser.java @@ -38,10 +38,13 @@ import java.util.Map; */ public class IssueJsonParser { + private static final String ISSUES = "issues"; + private static final String TOTAL = "total"; + public Issues parseIssues(String json) { DefaultIssues result = new DefaultIssues(); Map jsonRoot = (Map) JSONValue.parse(json); - List<Map> jsonIssues = (List<Map>) jsonRoot.get("issues"); + List<Map> jsonIssues = (List<Map>) jsonRoot.get(ISSUES); if (jsonIssues != null) { for (Map jsonIssue : jsonIssues) { result.add(new DefaultIssue(jsonIssue)); @@ -132,11 +135,11 @@ public class IssueJsonParser { Map jsonRoot = (Map) JSONValue.parse(json); Map issuesChanged = (Map) jsonRoot.get("issuesChanged"); - result.setTotalIssuesChanged(JsonUtils.getInteger(issuesChanged, "total")); + result.setTotalIssuesChanged(JsonUtils.getInteger(issuesChanged, TOTAL)); Map issuesNotChanged = (Map) jsonRoot.get("issuesNotChanged"); - result.setTotalIssuesNotChanged(JsonUtils.getInteger(issuesNotChanged, "total")); - JSONArray issuesJson = JsonUtils.getArray(issuesNotChanged, "issues"); + result.setTotalIssuesNotChanged(JsonUtils.getInteger(issuesNotChanged, TOTAL)); + JSONArray issuesJson = JsonUtils.getArray(issuesNotChanged, ISSUES); if (issuesJson != null) { result.setIssuesNotChanged(issuesJson); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java index a634c62a0bb..58242f95a36 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/RuleUnmarshaller.java @@ -31,6 +31,8 @@ import java.util.List; */ public class RuleUnmarshaller extends AbstractUnmarshaller<Rule> { + private static final String DESCRIPTION = "description"; + @Override protected Rule parse(Object json) { Rule rule = new Rule(); @@ -46,7 +48,7 @@ public class RuleUnmarshaller extends AbstractUnmarshaller<Rule> { .setKey(utils.getString(json, "key")) .setConfigKey(utils.getString(json, "config_key")) .setRepository(utils.getString(json, "plugin")) - .setDescription(utils.getString(json, "description")) + .setDescription(utils.getString(json, DESCRIPTION)) .setSeverity(utils.getString(json, "priority")) .setActive("ACTIVE".equals(utils.getString(json, "status"))); } @@ -80,7 +82,7 @@ public class RuleUnmarshaller extends AbstractUnmarshaller<Rule> { RuleParam param = new RuleParam(); param.setName(utils.getString(json, "name")) - .setDescription(utils.getString(json, "description")) + .setDescription(utils.getString(json, DESCRIPTION)) .setValue(utils.getString(json, "value")); return param; } |