chia7712 commented on code in PR #17597:
URL: https://github.com/apache/kafka/pull/17597#discussion_r1817103683
##########
core/src/main/scala/kafka/tools/StorageTool.scala:
##########
@@ -466,4 +470,27 @@ object StorageTool extends Logging {
}
}
}
+
+ def parseNameAndLevel(input: String): (String, java.lang.Short) = {
+ val equalsIndex = input.indexOf("=")
+ if (equalsIndex < 0)
+ throw new RuntimeException("Can't parse feature=level string " + input +
": equals sign not found.")
+ val name = input.substring(0, equalsIndex).trim
+ val levelString = input.substring(equalsIndex + 1).trim
+ try {
Review Comment:
```scala
try {
(name, levelString.toShort)
} catch {
case _: Throwable =>
throw new RuntimeException("Can't parse feature=level string " +
input + ": " + "unable to parse " + levelString + " as a short.")
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]