You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2021/11/17 01:11:07 UTC
[helix] branch master updated: fix input issue for stoppable rest API (#1905)
This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new 06d1c2b fix input issue for stoppable rest API (#1905)
06d1c2b is described below
commit 06d1c2b0cd00192cc1486aca68cbf8921cb0fdc0
Author: xyuanlu <xy...@gmail.com>
AuthorDate: Tue Nov 16 17:10:57 2021 -0800
fix input issue for stoppable rest API (#1905)
---
.../apache/helix/rest/server/resources/helix/InstancesAccessor.java | 2 +-
.../apache/helix/rest/server/resources/helix/PerInstanceAccessor.java | 3 +--
.../java/org/apache/helix/rest/server/service/InstanceServiceImpl.java | 3 +++
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/InstancesAccessor.java b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/InstancesAccessor.java
index 233cc54..46e20a7 100644
--- a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/InstancesAccessor.java
+++ b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/InstancesAccessor.java
@@ -211,7 +211,7 @@ public class InstancesAccessor extends AbstractHelixResource {
List<String> orderOfZone = null;
String customizedInput = null;
if (node.get(InstancesAccessor.InstancesProperties.customized_values.name()) != null) {
- customizedInput = node.get(InstancesAccessor.InstancesProperties.customized_values.name()).textValue();
+ customizedInput = node.get(InstancesAccessor.InstancesProperties.customized_values.name()).toString();
}
if (node.get(InstancesAccessor.InstancesProperties.zone_order.name()) != null) {
diff --git a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java
index 0367e63..02ed063 100644
--- a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java
+++ b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java
@@ -46,7 +46,6 @@ import org.apache.helix.ConfigAccessor;
import org.apache.helix.HelixAdmin;
import org.apache.helix.HelixDataAccessor;
import org.apache.helix.HelixException;
-import org.apache.helix.PropertyKey;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
import org.apache.helix.model.CurrentState;
import org.apache.helix.model.Error;
@@ -173,7 +172,7 @@ public class PerInstanceAccessor extends AbstractHelixResource {
String customizedInput = null;
if (node.get(InstancesAccessor.InstancesProperties.customized_values.name()) != null) {
- customizedInput = node.get(InstancesAccessor.InstancesProperties.customized_values.name()).textValue();
+ customizedInput = node.get(InstancesAccessor.InstancesProperties.customized_values.name()).toString();
}
stoppableCheck =
diff --git a/helix-rest/src/main/java/org/apache/helix/rest/server/service/InstanceServiceImpl.java b/helix-rest/src/main/java/org/apache/helix/rest/server/service/InstanceServiceImpl.java
index 6cc5592..d76d25b 100644
--- a/helix-rest/src/main/java/org/apache/helix/rest/server/service/InstanceServiceImpl.java
+++ b/helix-rest/src/main/java/org/apache/helix/rest/server/service/InstanceServiceImpl.java
@@ -318,6 +318,9 @@ public class InstanceServiceImpl implements InstanceService {
private Map<String, String> getCustomPayLoads(String jsonContent) throws IOException {
Map<String, String> result = new HashMap<>();
+ if (jsonContent == null) {
+ return result;
+ }
JsonNode jsonNode = OBJECT_MAPPER.readTree(jsonContent);
// parsing the inputs as string key value pairs
jsonNode.fields().forEachRemaining(kv -> result.put(kv.getKey(), kv.getValue().asText()));