Skip to content

Commit

Permalink
fix: Replaced bval StringUtils with private method
Browse files Browse the repository at this point in the history
  • Loading branch information
jruaux committed Dec 19, 2023
1 parent 57ec756 commit 3681b89
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/com/redis/trino/RediSearchSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import org.apache.bval.util.StringUtils;

import com.google.common.cache.Cache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -155,20 +153,24 @@ private ProtocolVersion protocolVersion(RediSearchConfig config) {

public SslOptions sslOptions(RediSearchConfig config) {
Builder ssl = SslOptions.builder();
if (StringUtils.isNotBlank(config.getKeyPath())) {
if (!isNullOrEmpty(config.getKeyPath())) {
ssl.keyManager(new File(config.getCertPath()), new File(config.getKeyPath()),
config.getKeyPassword().toCharArray());
}
if (StringUtils.isNotBlank(config.getCaCertPath())) {
if (!isNullOrEmpty(config.getCaCertPath())) {
ssl.trustManager(new File(config.getCaCertPath()));
}
return ssl.build();
}

private static boolean isNullOrEmpty(String s) {
return s == null || s.isEmpty();
}

private RedisURI redisURI(RediSearchConfig config) {
RedisURI.Builder uri = RedisURI.builder(RedisURI.create(config.getUri()));
if (StringUtils.isNotBlank(config.getPassword())) {
if (StringUtils.isNotBlank(config.getUsername())) {
if (!isNullOrEmpty(config.getPassword())) {
if (!isNullOrEmpty(config.getUsername())) {
uri.withAuthentication(config.getUsername(), config.getPassword());
} else {
uri.withPassword(config.getPassword().toCharArray());
Expand Down

0 comments on commit 3681b89

Please sign in to comment.