This is an automated email from the ASF dual-hosted git repository.

showuon pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 502f2ca  MINOR: Remove some unused codes (#11935)
502f2ca is described below

commit 502f2caca4fca520a6b22191573112b3784f5e34
Author: dengziming <[email protected]>
AuthorDate: Fri Apr 1 11:39:50 2022 +0800

    MINOR: Remove some unused codes (#11935)
    
    `validateChars` and `BaseEnum` are used in old version of clients. Remove 
them.
    
    Reviewers: Luke Chen <[email protected]>
---
 .../src/main/scala/kafka/admin/ConfigCommand.scala |  5 ++-
 core/src/main/scala/kafka/common/BaseEnum.scala    | 26 --------------
 core/src/main/scala/kafka/common/Config.scala      | 41 ----------------------
 3 files changed, 2 insertions(+), 70 deletions(-)

diff --git a/core/src/main/scala/kafka/admin/ConfigCommand.scala 
b/core/src/main/scala/kafka/admin/ConfigCommand.scala
index 5e5ccef..4676bfd 100644
--- a/core/src/main/scala/kafka/admin/ConfigCommand.scala
+++ b/core/src/main/scala/kafka/admin/ConfigCommand.scala
@@ -22,11 +22,10 @@ import java.util.concurrent.TimeUnit
 import java.util.{Collections, Properties}
 
 import joptsimple._
-import kafka.common.Config
 import kafka.log.LogConfig
 import kafka.server.DynamicConfig.QuotaConfigs
 import kafka.server.{ConfigEntityName, ConfigType, Defaults, 
DynamicBrokerConfig, DynamicConfig, KafkaConfig}
-import kafka.utils.{CommandDefaultOptions, CommandLineUtils, Exit, 
PasswordEncoder}
+import kafka.utils.{CommandDefaultOptions, CommandLineUtils, Exit, Logging, 
PasswordEncoder}
 import kafka.utils.Implicits._
 import kafka.zk.{AdminZkClient, KafkaZkClient}
 import org.apache.kafka.clients.admin.{Admin, AlterClientQuotasOptions, 
AlterConfigOp, AlterConfigsOptions, ConfigEntry, DescribeClusterOptions, 
DescribeConfigsOptions, ListTopicsOptions, ScramCredentialInfo, 
UserScramCredentialDeletion, UserScramCredentialUpsertion, Config => JConfig, 
ScramMechanism => PublicScramMechanism}
@@ -74,7 +73,7 @@ import scala.collection._
  * For example, this allows password configs to be stored encrypted in ZK 
before brokers are started,
  * avoiding cleartext passwords in `server.properties`.
  */
-object ConfigCommand extends Config {
+object ConfigCommand extends Logging {
 
   val BrokerDefaultEntityName = ""
   val BrokerLoggerConfigType = "broker-loggers"
diff --git a/core/src/main/scala/kafka/common/BaseEnum.scala 
b/core/src/main/scala/kafka/common/BaseEnum.scala
deleted file mode 100644
index 9c39466..0000000
--- a/core/src/main/scala/kafka/common/BaseEnum.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package kafka.common
-
-/*
- * We inherit from `Product` and `Serializable` because `case` objects and 
classes inherit from them and if we don't
- * do it here, the compiler will infer types that unexpectedly include 
`Product` and `Serializable`, see
- * http://underscore.io/blog/posts/2015/06/04/more-on-sealed.html for more 
information.
- */
-trait BaseEnum extends Product with Serializable {
-  def name: String
-}
diff --git a/core/src/main/scala/kafka/common/Config.scala 
b/core/src/main/scala/kafka/common/Config.scala
deleted file mode 100644
index f56cca8..0000000
--- a/core/src/main/scala/kafka/common/Config.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package kafka.common
-
-import util.matching.Regex
-import kafka.utils.Logging
-import org.apache.kafka.common.errors.InvalidConfigurationException
-
-trait Config extends Logging {
-
-  def validateChars(prop: String, value: String): Unit = {
-    val legalChars = "[a-zA-Z0-9\\._\\-]"
-    val rgx = new Regex(legalChars + "*")
-
-    rgx.findFirstIn(value) match {
-      case Some(t) =>
-        if (!t.equals(value))
-          throw new InvalidConfigurationException(prop + " " + value + " is 
illegal, contains a character other than ASCII alphanumerics, '.', '_' and '-'")
-      case None => throw new InvalidConfigurationException(prop + " " + value 
+ " is illegal, contains a character other than ASCII alphanumerics, '.', '_' 
and '-'")
-    }
-  }
-}
-
-
-
-

Reply via email to