Skip to content
Snippets Groups Projects
Commit 0f9a990d 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 f537bccd
No related branches found
No related tags found
No related merge requests found
...@@ -155,9 +155,14 @@ public final class KafkaWorkloadGeneratorBuilder<T extends SpecificRecord> { // ...@@ -155,9 +155,14 @@ public final class KafkaWorkloadGeneratorBuilder<T extends SpecificRecord> { //
* @return the built instance of the {@link KafkaWorkloadGenerator}. * @return the built instance of the {@link KafkaWorkloadGenerator}.
*/ */
public KafkaWorkloadGenerator<T> build() { 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."); 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.keySpace, "Please specify the key space.");
Objects.requireNonNull(this.period, "Please specify the period."); Objects.requireNonNull(this.period, "Please specify the period.");
Objects.requireNonNull(this.duration, "Please specify the duration."); Objects.requireNonNull(this.duration, "Please specify the duration.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment