From 57a4452f1f6b843c77d71ff943666e2c2f03f6c8 Mon Sep 17 00:00:00 2001 From: zane-neo Date: Wed, 28 Aug 2024 16:10:36 +0800 Subject: [PATCH 1/2] Fix gradle task forbiddenApisMain failure Signed-off-by: zane-neo --- src/main/java/org/opensearch/agent/tools/CreateAlertTool.java | 4 ++-- .../org/opensearch/agent/tools/CreateAnomalyDetectorTool.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/opensearch/agent/tools/CreateAlertTool.java b/src/main/java/org/opensearch/agent/tools/CreateAlertTool.java index 1d6b1c36..018005a3 100644 --- a/src/main/java/org/opensearch/agent/tools/CreateAlertTool.java +++ b/src/main/java/org/opensearch/agent/tools/CreateAlertTool.java @@ -18,7 +18,6 @@ import java.util.regex.Pattern; import org.apache.commons.text.StringSubstitutor; -import org.apache.logging.log4j.util.Strings; import org.opensearch.action.ActionRequest; import org.opensearch.action.admin.indices.get.GetIndexRequest; import org.opensearch.action.support.IndicesOptions; @@ -27,6 +26,7 @@ import org.opensearch.client.Client; import org.opensearch.cluster.metadata.MappingMetadata; import org.opensearch.core.action.ActionListener; +import org.opensearch.core.common.Strings; import org.opensearch.core.common.logging.LoggerMessageFormat; import org.opensearch.ml.common.FunctionName; import org.opensearch.ml.common.dataset.remote.RemoteInferenceInputDataSet; @@ -275,7 +275,7 @@ public void init(Client client) { @Override public CreateAlertTool create(Map params) { String modelId = (String) params.get(MODEL_ID); - if (Strings.isBlank(modelId)) { + if (org.apache.commons.lang3.StringUtils.isBlank(modelId)) { throw new IllegalArgumentException("model_id cannot be null or blank."); } String modelType = (String) params.getOrDefault("model_type", ModelType.CLAUDE.toString()); diff --git a/src/main/java/org/opensearch/agent/tools/CreateAnomalyDetectorTool.java b/src/main/java/org/opensearch/agent/tools/CreateAnomalyDetectorTool.java index 52811e61..bd018698 100644 --- a/src/main/java/org/opensearch/agent/tools/CreateAnomalyDetectorTool.java +++ b/src/main/java/org/opensearch/agent/tools/CreateAnomalyDetectorTool.java @@ -31,6 +31,7 @@ import org.opensearch.client.Client; import org.opensearch.cluster.metadata.MappingMetadata; import org.opensearch.core.action.ActionListener; +import org.opensearch.core.common.Strings; import org.opensearch.ml.common.FunctionName; import org.opensearch.ml.common.dataset.remote.RemoteInferenceInputDataSet; import org.opensearch.ml.common.input.MLInput; @@ -44,7 +45,6 @@ import com.google.common.collect.ImmutableMap; -import joptsimple.internal.Strings; import lombok.Getter; import lombok.Setter; import lombok.extern.log4j.Log4j2; From 6aec729de6af2147bb7c60e041ea3f3b02d064ef Mon Sep 17 00:00:00 2001 From: zane-neo Date: Wed, 28 Aug 2024 16:17:12 +0800 Subject: [PATCH 2/2] fix compilation error since AD change Signed-off-by: zane-neo --- .../opensearch/agent/tools/SearchAnomalyDetectorsToolTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/org/opensearch/agent/tools/SearchAnomalyDetectorsToolTests.java b/src/test/java/org/opensearch/agent/tools/SearchAnomalyDetectorsToolTests.java index e0b04336..f7ab651e 100644 --- a/src/test/java/org/opensearch/agent/tools/SearchAnomalyDetectorsToolTests.java +++ b/src/test/java/org/opensearch/agent/tools/SearchAnomalyDetectorsToolTests.java @@ -93,6 +93,7 @@ public void setup() { null, null, null, + null, null ); }