|
45 | 45 | import java.util.concurrent.TimeUnit; |
46 | 46 | import java.util.stream.Collectors; |
47 | 47 |
|
48 | | -import org.apache.bval.util.StringUtils; |
49 | | - |
50 | 48 | import com.google.common.cache.Cache; |
51 | 49 | import com.google.common.collect.ImmutableList; |
52 | 50 | import com.google.common.collect.ImmutableSet; |
@@ -155,20 +153,24 @@ private ProtocolVersion protocolVersion(RediSearchConfig config) { |
155 | 153 |
|
156 | 154 | public SslOptions sslOptions(RediSearchConfig config) { |
157 | 155 | Builder ssl = SslOptions.builder(); |
158 | | - if (StringUtils.isNotBlank(config.getKeyPath())) { |
| 156 | + if (!isNullOrEmpty(config.getKeyPath())) { |
159 | 157 | ssl.keyManager(new File(config.getCertPath()), new File(config.getKeyPath()), |
160 | 158 | config.getKeyPassword().toCharArray()); |
161 | 159 | } |
162 | | - if (StringUtils.isNotBlank(config.getCaCertPath())) { |
| 160 | + if (!isNullOrEmpty(config.getCaCertPath())) { |
163 | 161 | ssl.trustManager(new File(config.getCaCertPath())); |
164 | 162 | } |
165 | 163 | return ssl.build(); |
166 | 164 | } |
| 165 | + |
| 166 | + private static boolean isNullOrEmpty(String s) { |
| 167 | + return s == null || s.isEmpty(); |
| 168 | + } |
167 | 169 |
|
168 | 170 | private RedisURI redisURI(RediSearchConfig config) { |
169 | 171 | RedisURI.Builder uri = RedisURI.builder(RedisURI.create(config.getUri())); |
170 | | - if (StringUtils.isNotBlank(config.getPassword())) { |
171 | | - if (StringUtils.isNotBlank(config.getUsername())) { |
| 172 | + if (!isNullOrEmpty(config.getPassword())) { |
| 173 | + if (!isNullOrEmpty(config.getUsername())) { |
172 | 174 | uri.withAuthentication(config.getUsername(), config.getPassword()); |
173 | 175 | } else { |
174 | 176 | uri.withPassword(config.getPassword().toCharArray()); |
|
0 commit comments