Skip to content

Commit c5e6906

Browse files
committed
fix 201 bug
1 parent 8a14164 commit c5e6906

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>io.github.kubesys</groupId>
77
<artifactId>client-java</artifactId>
8-
<version>1.0.3</version>
8+
<version>1.0.4</version>
99
<packaging>jar</packaging>
1010

1111
<name>client-java</name>

src/main/java/io/github/kubesys/client/KubernetesClient.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
import com.fasterxml.jackson.databind.JsonNode;
6060
import com.fasterxml.jackson.databind.ObjectMapper;
61+
import com.fasterxml.jackson.databind.SerializationFeature;
6162
import com.fasterxml.jackson.databind.node.ArrayNode;
6263
import com.fasterxml.jackson.databind.node.ObjectNode;
6364
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
@@ -1617,15 +1618,20 @@ protected synchronized JsonNode parseResponse(CloseableHttpResponse response) {
16171618
switch (response.getCode()) {
16181619
case 200:
16191620
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());
16211624
} catch (Exception e) {
16221625
throw new KubernetesUnknownException(e.toString());
16231626
}
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+
}
16291635
case 400:
16301636
throw new KubernetesBadRequestException(response.toString());
16311637
case 401:

src/test/java/io/github/kubesys/client/install/stack/KubeMessageTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public static void main(String[] args) throws Exception {
5252
new Env("RABBITMQ_DEFAULT_PASS", new ValueFrom(
5353
new SecretKeyRef(NAME, StackCommon.CONFIG_PASSWORD)))},
5454
new Port[] {
55+
new Port(15674),
5556
new Port(15672),
5657
new Port(5672)
5758
},
@@ -65,6 +66,7 @@ public static void main(String[] args) throws Exception {
6566
service.withType("NodePort").withSelector(NAME)
6667
.withPort(15672, 30305, "management")
6768
.withPort(5672, 30304, "rabbitmq")
69+
.withPort(15674, 30303, "web")
6870
.stream(System.out);
6971
}
7072
}

0 commit comments

Comments
 (0)