SUPPORT-9536: Fix npe
This commit is contained in:
parent
b251439461
commit
de2db2a9db
1 changed files with 8 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ import java.net.http.HttpResponse;
|
|||
import java.time.Duration;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
|
@ -78,10 +79,13 @@ public class MchdService {
|
|||
private boolean isEsiaMchdNotFoundError(HttpResponse<String> response)
|
||||
throws JsonProcessingException {
|
||||
if (response.statusCode() == 400) {
|
||||
String errorCode = objectMapper.readTree(response.body())
|
||||
.get("code")
|
||||
.asText();
|
||||
return errorCode.equals("ESIA-044009");
|
||||
JsonNode jsonNode = objectMapper.readTree(response.body())
|
||||
.get("code");
|
||||
if (jsonNode == null) {
|
||||
return false;
|
||||
}
|
||||
String errorCode = jsonNode.asText();
|
||||
return errorCode != null && errorCode.equals("ESIA-044009");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue