Add some verifications on db# and port when creating data adapter
This commit is contained in:
parent
31cef8b0a6
commit
1a0320fc21
@ -237,20 +237,18 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
return new AutoValue_RedisLookupDataAdapter_Config.Builder();
|
return new AutoValue_RedisLookupDataAdapter_Config.Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Override
|
@Override
|
||||||
public Optional<Multimap<String, String>> validate() {
|
public Optional<Multimap<String, String>> validate() {
|
||||||
final ArrayListMultimap<String, String> errors = ArrayListMultimap.create();
|
final ArrayListMultimap<String, String> errors = ArrayListMultimap.create();
|
||||||
|
|
||||||
if (redisPort() < 1 || redisPort() > 65535) {
|
if (redisPort() < 1 || redisPort() > 65535) {
|
||||||
errors.put("redis_port", "Value cannot neither be smaller than 1 nor greater than 65535");
|
errors.put("redis_port", "Value cannot neither be smaller than 1 nor greater than 65535");
|
||||||
}
|
}
|
||||||
if (redisDB() < 0) {
|
if (redisDB() < 0) {
|
||||||
errors.put("redis_database", "Value cannot be smaller than 0");
|
errors.put("redis_database", "Value cannot be smaller than 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors.isEmpty() ? Optional.empty() : Optional.of(errors);
|
return errors.isEmpty() ? Optional.empty() : Optional.of(errors);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
@AutoValue.Builder
|
@AutoValue.Builder
|
||||||
public abstract static class Builder {
|
public abstract static class Builder {
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
|
Loading…
Reference in New Issue
Block a user