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