mirror of https://github.com/apache/kafka.git
MINOR: Fix some compiler warnings (#12912)
Reviewers: Ismael Juma <ismael@juma.me.uk>, Luke Chen <showuon@gmail.com>
This commit is contained in:
parent
d23ce20bdf
commit
42cfd57a24
|
|
@ -135,7 +135,7 @@ object ConfigCommand extends Logging {
|
|||
val errorMessage = s"--bootstrap-server option must be specified to update $entityType configs: {add: $configsToBeAdded, delete: $configsToBeDeleted}"
|
||||
|
||||
if (entityType == ConfigType.User) {
|
||||
if (!configsToBeAdded.isEmpty || !configsToBeDeleted.isEmpty) {
|
||||
if (!configsToBeAdded.isEmpty || configsToBeDeleted.nonEmpty) {
|
||||
val info = "User configuration updates using ZooKeeper are only supported for SCRAM credential updates."
|
||||
val scramMechanismNames = ScramMechanism.values.map(_.mechanismName)
|
||||
// make sure every added/deleted configs are SCRAM related, other configs are not supported using zookeeper
|
||||
|
|
@ -146,7 +146,7 @@ object ConfigCommand extends Logging {
|
|||
preProcessScramCredentials(configsToBeAdded)
|
||||
} else if (entityType == ConfigType.Broker) {
|
||||
// Dynamic broker configs can be updated using ZooKeeper only if the corresponding broker is not running.
|
||||
if (!configsToBeAdded.isEmpty || !configsToBeDeleted.isEmpty) {
|
||||
if (!configsToBeAdded.isEmpty || configsToBeDeleted.nonEmpty) {
|
||||
validateBrokersNotRunning(entityName, adminZkClient, zkClient, errorMessage)
|
||||
|
||||
val perBrokerConfig = entityName != ConfigEntityName.Default
|
||||
|
|
@ -253,7 +253,7 @@ object ConfigCommand extends Logging {
|
|||
private[admin] def describeConfigWithZk(zkClient: KafkaZkClient, opts: ConfigCommandOptions, adminZkClient: AdminZkClient): Unit = {
|
||||
val configEntity = parseEntity(opts)
|
||||
val entityType = configEntity.root.entityType
|
||||
val describeAllUsers = entityType == ConfigType.User && !configEntity.root.sanitizedName.isDefined && !configEntity.child.isDefined
|
||||
val describeAllUsers = entityType == ConfigType.User && configEntity.root.sanitizedName.isEmpty && configEntity.child.isEmpty
|
||||
val entityName = configEntity.fullSanitizedName
|
||||
val errorMessage = s"--bootstrap-server option must be specified to describe $entityType"
|
||||
if (entityType == ConfigType.Broker) {
|
||||
|
|
@ -548,7 +548,7 @@ object ConfigCommand extends Logging {
|
|||
|
||||
val (configResourceType, dynamicConfigSource) = entityType match {
|
||||
case ConfigType.Topic =>
|
||||
if (!entityName.isEmpty)
|
||||
if (entityName.nonEmpty)
|
||||
Topic.validate(entityName)
|
||||
(ConfigResource.Type.TOPIC, Some(ConfigEntry.ConfigSource.DYNAMIC_TOPIC_CONFIG))
|
||||
case ConfigType.Broker => entityName match {
|
||||
|
|
@ -559,7 +559,7 @@ object ConfigCommand extends Logging {
|
|||
(ConfigResource.Type.BROKER, Some(ConfigEntry.ConfigSource.DYNAMIC_BROKER_CONFIG))
|
||||
}
|
||||
case BrokerLoggerConfigType =>
|
||||
if (!entityName.isEmpty)
|
||||
if (entityName.nonEmpty)
|
||||
validateBrokerId()
|
||||
(ConfigResource.Type.BROKER_LOGGER, None)
|
||||
case entityType => throw new IllegalArgumentException(s"Invalid entity type: $entityType")
|
||||
|
|
@ -581,7 +581,7 @@ object ConfigCommand extends Logging {
|
|||
}).toSeq
|
||||
}
|
||||
|
||||
private def describeQuotaConfigs(adminClient: Admin, entityTypes: List[String], entityNames: List[String]) = {
|
||||
private def describeQuotaConfigs(adminClient: Admin, entityTypes: List[String], entityNames: List[String]): Unit = {
|
||||
val quotaConfigs = getAllClientQuotasConfigs(adminClient, entityTypes, entityNames)
|
||||
quotaConfigs.forKeyValue { (entity, entries) =>
|
||||
val entityEntries = entity.entries.asScala
|
||||
|
|
@ -605,7 +605,7 @@ object ConfigCommand extends Logging {
|
|||
}
|
||||
}
|
||||
|
||||
private def describeClientQuotaAndUserScramCredentialConfigs(adminClient: Admin, entityTypes: List[String], entityNames: List[String]) = {
|
||||
private def describeClientQuotaAndUserScramCredentialConfigs(adminClient: Admin, entityTypes: List[String], entityNames: List[String]): Unit = {
|
||||
describeQuotaConfigs(adminClient, entityTypes, entityNames)
|
||||
// we describe user SCRAM credentials only when we are not describing client information
|
||||
// and we are not given either --entity-default or --user-defaults
|
||||
|
|
@ -889,7 +889,7 @@ object ConfigCommand extends Logging {
|
|||
(entityFlags ++ entityDefaultsFlags).exists(entity => options.has(entity._1)))
|
||||
throw new IllegalArgumentException("--entity-{type,name,default} should not be used in conjunction with specific entity flags")
|
||||
|
||||
val hasEntityName = entityNames.exists(!_.isEmpty)
|
||||
val hasEntityName = entityNames.exists(_.nonEmpty)
|
||||
val hasEntityDefault = entityNames.exists(_.isEmpty)
|
||||
|
||||
if (!options.has(bootstrapServerOpt) && !options.has(zkConnectOpt))
|
||||
|
|
|
|||
|
|
@ -1341,7 +1341,7 @@ object ReassignPartitionsCommand extends Logging {
|
|||
CommandLineUtils.printUsageAndDie(opts.parser, "Command must include exactly one action: %s".format(
|
||||
validActions.map("--" + _.options().get(0)).mkString(", ")))
|
||||
}
|
||||
val action = allActions(0)
|
||||
val action = allActions.head
|
||||
|
||||
if (!opts.options.has(opts.bootstrapServerOpt))
|
||||
CommandLineUtils.printUsageAndDie(opts.parser, "Please specify --bootstrap-server")
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ object TopicCommand extends Logging {
|
|||
def partitions: Option[Integer] = valueAsOption(partitionsOpt)
|
||||
def replicationFactor: Option[Integer] = valueAsOption(replicationFactorOpt)
|
||||
def replicaAssignment: Option[Map[Int, List[Int]]] =
|
||||
if (has(replicaAssignmentOpt) && !Option(options.valueOf(replicaAssignmentOpt)).getOrElse("").isEmpty)
|
||||
if (has(replicaAssignmentOpt) && Option(options.valueOf(replicaAssignmentOpt)).getOrElse("").nonEmpty)
|
||||
Some(parseReplicaAssignment(options.valueOf(replicaAssignmentOpt)))
|
||||
else
|
||||
None
|
||||
|
|
|
|||
Loading…
Reference in New Issue