fix: 获取jira缺陷时出现空指针的问题

This commit is contained in:
shiziyuan9527 2020-09-07 11:38:02 +08:00
parent 306773ddcd
commit 34bf64ce73
1 changed files with 11 additions and 3 deletions

View File

@ -346,10 +346,19 @@ public class IssuesService {
String body = responseEntity.getBody(); String body = responseEntity.getBody();
JSONObject obj = JSONObject.parseObject(body); JSONObject obj = JSONObject.parseObject(body);
LogUtil.info(obj);
String lastmodify = "";
String status = "";
JSONObject fields = (JSONObject) obj.get("fields"); JSONObject fields = (JSONObject) obj.get("fields");
JSONObject statusObj = (JSONObject) fields.get("status"); JSONObject statusObj = (JSONObject) fields.get("status");
JSONObject assignee = (JSONObject) fields.get("assignee"); JSONObject assignee = (JSONObject) fields.get("assignee");
if (statusObj != null) {
JSONObject statusCategory = (JSONObject) statusObj.get("statusCategory"); JSONObject statusCategory = (JSONObject) statusObj.get("statusCategory");
status = statusCategory.getString("key");
}
String id = obj.getString("id"); String id = obj.getString("id");
String title = fields.getString("summary"); String title = fields.getString("summary");
@ -360,9 +369,8 @@ public class IssuesService {
HtmlRenderer renderer = HtmlRenderer.builder().build(); HtmlRenderer renderer = HtmlRenderer.builder().build();
description = renderer.render(document); description = renderer.render(document);
String status = statusCategory.getString("key");
Long createTime = fields.getLong("created"); Long createTime = fields.getLong("created");
String lastmodify = "";
if (assignee != null) { if (assignee != null) {
lastmodify = assignee.getString("displayName"); lastmodify = assignee.getString("displayName");
} }