From 14f4ce092653953cd8e45c5909cce721e1332137 Mon Sep 17 00:00:00 2001 From: Rishab Nahata Date: Fri, 30 Sep 2022 00:45:25 +0530 Subject: [PATCH] Use String utility Signed-off-by: Rishab Nahata --- .../decommission/awareness/put/DecommissionRequest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/decommission/awareness/put/DecommissionRequest.java b/server/src/main/java/org/opensearch/action/admin/cluster/decommission/awareness/put/DecommissionRequest.java index 9756bf96dd66d..79a6688dc6049 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/decommission/awareness/put/DecommissionRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/decommission/awareness/put/DecommissionRequest.java @@ -11,6 +11,7 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest; import org.opensearch.cluster.decommission.DecommissionAttribute; +import org.opensearch.common.Strings; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; @@ -67,10 +68,10 @@ public DecommissionAttribute getDecommissionAttribute() { @Override public ActionRequestValidationException validate() { ActionRequestValidationException validationException = null; - if (decommissionAttribute.attributeName() == null || decommissionAttribute.attributeName().isEmpty()) { + if (decommissionAttribute.attributeName() == null || Strings.isEmpty(decommissionAttribute.attributeName())) { validationException = addValidationError("attribute name is missing", validationException); } - if (decommissionAttribute.attributeValue() == null || decommissionAttribute.attributeValue().isEmpty()) { + if (decommissionAttribute.attributeValue() == null || Strings.isEmpty(decommissionAttribute.attributeValue())) { validationException = addValidationError("attribute value is missing", validationException); } return validationException;