Skip to content
Snippets Groups Projects
Commit 6c2ae772 authored by Björn Vonheiden's avatar Björn Vonheiden
Browse files

Fix check for correct configuration valuen in WorkloadGeneratorBuilder

As ints will not be null on a null check, better check for the values
of an int.
parent 12e99080
No related branches found
No related tags found
1 merge request!28Use Titan CC Avro Records in UC App and Workload Generator
......@@ -155,9 +155,14 @@ public final class KafkaWorkloadGeneratorBuilder<T extends SpecificRecord> { //
* @return the built instance of the {@link KafkaWorkloadGenerator}.
*/
public KafkaWorkloadGenerator<T> build() {
Objects.requireNonNull(this.instances, "Please specify the number of instances.");
if (this.instances < 1) { // NOPMD
throw new IllegalArgumentException(
"Please specify a valid number of instances. Currently: " + this.instances);
}
Objects.requireNonNull(this.zooKeeper, "Please specify the ZooKeeper instance.");
this.threads = Objects.requireNonNullElse(this.threads, 1);
if (this.threads < 1) { // NOPMD
this.threads = 1;
}
Objects.requireNonNull(this.keySpace, "Please specify the key space.");
Objects.requireNonNull(this.period, "Please specify the period.");
Objects.requireNonNull(this.duration, "Please specify the duration.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment