jolshan commented on code in PR #15685: URL: https://github.com/apache/kafka/pull/15685#discussion_r1603875839
########## core/src/main/scala/kafka/tools/StorageTool.scala: ########## @@ -469,4 +522,28 @@ object StorageTool extends Logging { } 0 } + + private def parseNameAndLevel(input: String): Array[String] = { + 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 { + levelString.toShort + } catch { + case _: Throwable => + throw new RuntimeException("Can't parse feature=level string " + input + ": " + "unable to parse " + levelString + " as a short.") + } + Array[String](name, levelString) Review Comment: I pulled this method from FeatureCommand (originally I wanted them to use a shared method from a helper but that was a headache so I duplicated the method.) I can revise this one though. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org