From de8acfd6e02afec5e466823b73865caab01c6f88 Mon Sep 17 00:00:00 2001 From: Chirag Dewan Date: Sun, 7 Jun 2020 15:29:59 +0530 Subject: [PATCH] BAEL3889 - Adding braces in EvenOddPartitioner --- .../java/com/baeldung/kafka/producer/EvenOddPartitioner.java | 5 +++-- .../main/java/com/baeldung/kafka/producer/KafkaProducer.java | 2 +- .../com/baeldung/kafka/producer/KafkaProducerUnitTest.java | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java b/libraries-data-2/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java index 12c86828dd..1c77226037 100644 --- a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java +++ b/libraries-data-2/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java @@ -1,4 +1,4 @@ -package com.baeldung.kafka; +package com.baeldung.kafka.producer; import org.apache.kafka.clients.producer.internals.DefaultPartitioner; import org.apache.kafka.common.Cluster; @@ -8,8 +8,9 @@ public class EvenOddPartitioner extends DefaultPartitioner { @Override public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { - if (((String)key).length() % 2 == 0) + if (((String) key).length() % 2 == 0) { return 0; + } return 1; } diff --git a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java b/libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java index 8574cd1c40..911c9ed3d7 100644 --- a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java +++ b/libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java @@ -1,4 +1,4 @@ -package com.baeldung.kafka; +package com.baeldung.kafka.producer; import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; diff --git a/libraries-data-2/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java b/libraries-data-2/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java index ce3803322c..a7156ed886 100644 --- a/libraries-data-2/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java +++ b/libraries-data-2/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java @@ -1,5 +1,7 @@ -package com.baeldung.kafka; +package com.baeldung.kafka.producer; +import com.baeldung.kafka.producer.EvenOddPartitioner; +import com.baeldung.kafka.producer.KafkaProducer; import org.apache.kafka.clients.producer.MockProducer; import org.apache.kafka.clients.producer.RecordMetadata; import org.apache.kafka.common.Cluster;