|
58 | 58 |
|
59 | 59 | import com.fasterxml.jackson.databind.JsonNode; |
60 | 60 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 61 | +import com.fasterxml.jackson.databind.SerializationFeature; |
61 | 62 | import com.fasterxml.jackson.databind.node.ArrayNode; |
62 | 63 | import com.fasterxml.jackson.databind.node.ObjectNode; |
63 | 64 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; |
@@ -1617,15 +1618,20 @@ protected synchronized JsonNode parseResponse(CloseableHttpResponse response) { |
1617 | 1618 | switch (response.getCode()) { |
1618 | 1619 | case 200: |
1619 | 1620 | try { |
1620 | | - return new ObjectMapper().readTree(response.getEntity().getContent()); |
| 1621 | + ObjectMapper objectMapper = new ObjectMapper(); |
| 1622 | + objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); |
| 1623 | + return objectMapper.readTree(response.getEntity().getContent()); |
1621 | 1624 | } catch (Exception e) { |
1622 | 1625 | throw new KubernetesUnknownException(e.toString()); |
1623 | 1626 | } |
1624 | | -// if (result.has("status") && result.get("status").asText().equals("Failure")) { |
1625 | | -// int code = result.get("code").asInt(); |
1626 | | -// String cause = statusDesc.get(code); |
1627 | | -// throw new Exception(cause != null ? cause : result.toPrettyString()); |
1628 | | -// } |
| 1627 | + case 201: |
| 1628 | + try { |
| 1629 | + ObjectMapper objectMapper = new ObjectMapper(); |
| 1630 | + objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); |
| 1631 | + return objectMapper.readTree(response.getEntity().getContent()); |
| 1632 | + } catch (Exception e) { |
| 1633 | + throw new KubernetesUnknownException(e.toString()); |
| 1634 | + } |
1629 | 1635 | case 400: |
1630 | 1636 | throw new KubernetesBadRequestException(response.toString()); |
1631 | 1637 | case 401: |
|
0 commit comments