Skip to content

Commit

Permalink
Remove dependency on commons-lang3 (#203)
Browse files Browse the repository at this point in the history
Was only used to check for strings being null or empty. We don't need a
whole extra library dependency for that (especially since OpenSearch
already provides a utility method for that).

Signed-off-by: Michael Froh <froh@amazon.com>
  • Loading branch information
msfroh authored Sep 5, 2023
1 parent 2103097 commit 7e56847
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion amazon-kendra-intelligent-ranking/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ repositories {

dependencies {
implementation 'com.ibm.icu:icu4j:57.2'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'org.apache.httpcomponents:httpcore:4.4.16'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@

import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.security.AccessController;
import java.security.PrivilegedAction;

import org.apache.commons.lang3.StringUtils;
import org.opensearch.core.common.Strings;
import org.opensearch.search.relevance.transformer.kendraintelligentranking.model.dto.RescoreRequest;
import org.opensearch.search.relevance.transformer.kendraintelligentranking.model.dto.RescoreResult;

Expand Down Expand Up @@ -132,11 +131,11 @@ public URI buildRescoreURI() {
}

public boolean isValid() {
return StringUtils.isNotEmpty(serviceEndpoint) && StringUtils.isNotEmpty(executionPlanId);
return !Strings.isNullOrEmpty(serviceEndpoint) && !Strings.isNullOrEmpty(executionPlanId);
}

@Override
public void close() throws IOException {
public void close() {
if (amazonHttpClient != null) {
amazonHttpClient.shutdown();
}
Expand Down

0 comments on commit 7e56847

Please sign in to comment.