Browse Source

[FIXBUG][common]fix yarn applications status cause NPE(#3645) (#3648)

* fix #3645

fix get yarn applications status from yarn server,http code return 404, get yarn applications status cause NullPointerException

* Update HadoopUtils.java

* Update HadoopUtils.java
pull/3/MERGE
小清 4 years ago committed by GitHub
parent
commit
ba3adbd34b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java

8
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java

@ -425,17 +425,25 @@ public class HadoopUtils implements Closeable {
} }
if (responseContent != null) { if (responseContent != null) {
ObjectNode jsonObject = JSONUtils.parseObject(responseContent); ObjectNode jsonObject = JSONUtils.parseObject(responseContent);
if (!jsonObject.has("app")) {
return ExecutionStatus.FAILURE;
}
result = jsonObject.path("app").path("finalStatus").asText(); result = jsonObject.path("app").path("finalStatus").asText();
} else { } else {
//may be in job history //may be in job history
String jobHistoryUrl = getJobHistoryUrl(applicationId); String jobHistoryUrl = getJobHistoryUrl(applicationId);
logger.info("jobHistoryUrl={}", jobHistoryUrl); logger.info("jobHistoryUrl={}", jobHistoryUrl);
responseContent = HttpUtils.get(jobHistoryUrl); responseContent = HttpUtils.get(jobHistoryUrl);
if (null != responseContent) {
ObjectNode jsonObject = JSONUtils.parseObject(responseContent); ObjectNode jsonObject = JSONUtils.parseObject(responseContent);
if (!jsonObject.has("job")) { if (!jsonObject.has("job")) {
return ExecutionStatus.FAILURE; return ExecutionStatus.FAILURE;
} }
result = jsonObject.path("job").path("state").asText(); result = jsonObject.path("job").path("state").asText();
} else {
return ExecutionStatus.FAILURE;
}
} }
switch (result) { switch (result) {

Loading…
Cancel
Save