Repository: kafka
Updated Branches:
  refs/heads/trunk 6199c6277 -> 4e0b0b83a


MINOR: Code refactor - cleaning up some boolean assignments

Author: Ishita Mandhan <iman...@us.ibm.com>

Reviewers: Vahid Hashemian <vahidhashem...@us.ibm.com>, Jason Gustafson 
<ja...@confluent.io>

Closes #2013 from imandhan/KAFKA-refactor


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/4e0b0b83
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/4e0b0b83
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/4e0b0b83

Branch: refs/heads/trunk
Commit: 4e0b0b83a7af8fd7d6041d39275e9f82dba9d606
Parents: 6199c62
Author: Ishita Mandhan <iman...@us.ibm.com>
Authored: Mon Oct 17 16:58:21 2016 -0700
Committer: Jason Gustafson <ja...@confluent.io>
Committed: Mon Oct 17 16:58:21 2016 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/client/ClientUtils.scala        | 2 +-
 core/src/main/scala/kafka/consumer/ConsumerConfig.scala   | 2 +-
 core/src/main/scala/kafka/producer/SyncProducer.scala     | 2 +-
 core/src/main/scala/kafka/tools/ConsoleConsumer.scala     | 2 +-
 core/src/main/scala/kafka/tools/SimpleConsumerShell.scala | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/4e0b0b83/core/src/main/scala/kafka/client/ClientUtils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/client/ClientUtils.scala 
b/core/src/main/scala/kafka/client/ClientUtils.scala
index f61a978..fda8b0b 100755
--- a/core/src/main/scala/kafka/client/ClientUtils.scala
+++ b/core/src/main/scala/kafka/client/ClientUtils.scala
@@ -128,7 +128,7 @@ object ClientUtils extends Logging{
              false
          }
        }
-       connected = if (channel == null) false else true
+       connected = channel != null
      }
 
      channel

http://git-wip-us.apache.org/repos/asf/kafka/blob/4e0b0b83/core/src/main/scala/kafka/consumer/ConsumerConfig.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/consumer/ConsumerConfig.scala 
b/core/src/main/scala/kafka/consumer/ConsumerConfig.scala
index fd8983c..9eff3ed 100644
--- a/core/src/main/scala/kafka/consumer/ConsumerConfig.scala
+++ b/core/src/main/scala/kafka/consumer/ConsumerConfig.scala
@@ -174,7 +174,7 @@ class ConsumerConfig private (val props: 
VerifiableProperties) extends ZKConfig(
     * is required during migration from zookeeper-based offset storage to 
kafka-based offset storage. With respect to any
     * given consumer group, it is safe to turn this off after all instances 
within that group have been migrated to
     * the new jar that commits offsets to the broker (instead of directly to 
ZooKeeper). */
-  val dualCommitEnabled = props.getBoolean("dual.commit.enabled", if 
(offsetsStorage == "kafka") true else false)
+  val dualCommitEnabled = props.getBoolean("dual.commit.enabled", 
offsetsStorage == "kafka")
 
   /* what to do if an offset is out of range.
      smallest : automatically reset the offset to the smallest offset

http://git-wip-us.apache.org/repos/asf/kafka/blob/4e0b0b83/core/src/main/scala/kafka/producer/SyncProducer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/producer/SyncProducer.scala 
b/core/src/main/scala/kafka/producer/SyncProducer.scala
index de4f4ad..f02648f 100644
--- a/core/src/main/scala/kafka/producer/SyncProducer.scala
+++ b/core/src/main/scala/kafka/producer/SyncProducer.scala
@@ -107,7 +107,7 @@ class SyncProducer(val config: SyncProducerConfig) extends 
Logging {
     val aggregateTimer = 
producerRequestStats.getProducerRequestAllBrokersStats.requestTimer
     aggregateTimer.time {
       specificTimer.time {
-        response = doSend(producerRequest, if(producerRequest.requiredAcks == 
0) false else true)
+        response = doSend(producerRequest, producerRequest.requiredAcks != 0)
       }
     }
     if(producerRequest.requiredAcks != 0) {

http://git-wip-us.apache.org/repos/asf/kafka/blob/4e0b0b83/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala 
b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
index 361bef2..56ae0c9 100755
--- a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
+++ b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
@@ -303,7 +303,7 @@ object ConsoleConsumer extends Logging {
     val zkConnectionStr = options.valueOf(zkConnectOpt)
     val fromBeginning = options.has(resetBeginningOpt)
     val partitionArg = if (options.has(partitionIdOpt)) 
Some(options.valueOf(partitionIdOpt).intValue) else None
-    val skipMessageOnError = if (options.has(skipMessageOnErrorOpt)) true else 
false
+    val skipMessageOnError = options.has(skipMessageOnErrorOpt)
     val messageFormatterClass = 
Class.forName(options.valueOf(messageFormatterOpt))
     val formatterArgs = 
CommandLineUtils.parseKeyValueArgs(options.valuesOf(messageFormatterArgOpt).asScala)
     val maxMessages = if (options.has(maxMessagesOpt)) 
options.valueOf(maxMessagesOpt).intValue else -1

http://git-wip-us.apache.org/repos/asf/kafka/blob/4e0b0b83/core/src/main/scala/kafka/tools/SimpleConsumerShell.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/SimpleConsumerShell.scala 
b/core/src/main/scala/kafka/tools/SimpleConsumerShell.scala
index 26fa336..9368bda 100755
--- a/core/src/main/scala/kafka/tools/SimpleConsumerShell.scala
+++ b/core/src/main/scala/kafka/tools/SimpleConsumerShell.scala
@@ -112,8 +112,8 @@ object SimpleConsumerShell extends Logging {
     val maxWaitMs = options.valueOf(maxWaitMsOpt).intValue()
     val maxMessages = options.valueOf(maxMessagesOpt).intValue
 
-    val skipMessageOnError = if (options.has(skipMessageOnErrorOpt)) true else 
false
-    val printOffsets = if(options.has(printOffsetOpt)) true else false
+    val skipMessageOnError = options.has(skipMessageOnErrorOpt)
+    val printOffsets = options.has(printOffsetOpt)
     val noWaitAtEndOfLog = options.has(noWaitAtEndOfLogOpt)
 
     val messageFormatterClass = 
Class.forName(options.valueOf(messageFormatterOpt))

Reply via email to