From e03a120680ec4e707aaf3bcdf190793c9c6e3b97 Mon Sep 17 00:00:00 2001 From: Karthik Kumarguru <52506191+ktkrg@users.noreply.github.com> Date: Fri, 7 Aug 2020 19:31:03 -0700 Subject: [PATCH] Use StringUtils instead of NumberUtils to check timestamp string (#360) * Use StringUtils instead of NumberUtils to check timestamp string * Remove unused imports --- .../config/overrides/ConfigOverridesApplier.java | 4 ++-- .../decisionmaker/actions/ModifyCacheMaxSizeActionTest.java | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/config/overrides/ConfigOverridesApplier.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/config/overrides/ConfigOverridesApplier.java index 30f39cd4d..c2868454c 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/config/overrides/ConfigOverridesApplier.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/config/overrides/ConfigOverridesApplier.java @@ -22,7 +22,7 @@ import java.io.IOException; import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -115,7 +115,7 @@ private boolean valid(final String overridesJson, final String timestamp) { return false; } - return NumberUtils.isCreatable(timestamp); + return StringUtils.isNumeric(timestamp); } @VisibleForTesting diff --git a/src/test/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/decisionmaker/actions/ModifyCacheMaxSizeActionTest.java b/src/test/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/decisionmaker/actions/ModifyCacheMaxSizeActionTest.java index dbe07fe61..76e24132e 100644 --- a/src/test/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/decisionmaker/actions/ModifyCacheMaxSizeActionTest.java +++ b/src/test/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/decisionmaker/actions/ModifyCacheMaxSizeActionTest.java @@ -31,12 +31,10 @@ import com.amazon.opendistro.elasticsearch.performanceanalyzer.grpc.ResourceEnum; import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.configs.CacheDeciderConfig; import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.summaries.ResourceUtil; -import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.core.Stats; import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.util.InstanceDetails; import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.store.rca.cluster.NodeKey; import com.google.common.collect.ImmutableSet; import java.util.Map; -import org.checkerframework.checker.units.qual.Temperature; import org.junit.Before; import org.junit.Test;