You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by sh...@apache.org on 2022/07/11 02:37:14 UTC
[kafka] branch trunk updated: MINOR: Use String#format for niceMemoryUnits result (#12389)
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 23c92ce7936 MINOR: Use String#format for niceMemoryUnits result (#12389)
23c92ce7936 is described below
commit 23c92ce79366e86ca719e5e51c550c27324acd83
Author: SC <pc...@gmail.com>
AuthorDate: Mon Jul 11 11:36:56 2022 +0900
MINOR: Use String#format for niceMemoryUnits result (#12389)
Reviewers: Luke Chen <sh...@gmail.com>, Divij Vaidya <di...@amazon.com>
---
.../src/main/java/org/apache/kafka/common/config/ConfigDef.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java b/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java
index 9331f992268..1dfbebbe205 100644
--- a/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java
+++ b/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java
@@ -1243,15 +1243,16 @@ public class ConfigDef {
break;
}
}
+ String resultFormat = " (" + value + " %s" + (value == 1 ? ")" : "s)");
switch (i) {
case 1:
- return " (" + value + " kibibyte" + (value == 1 ? ")" : "s)");
+ return String.format(resultFormat, "kibibyte");
case 2:
- return " (" + value + " mebibyte" + (value == 1 ? ")" : "s)");
+ return String.format(resultFormat, "mebibyte");
case 3:
- return " (" + value + " gibibyte" + (value == 1 ? ")" : "s)");
+ return String.format(resultFormat, "gibibyte");
case 4:
- return " (" + value + " tebibyte" + (value == 1 ? ")" : "s)");
+ return String.format(resultFormat, "tebibyte");
default:
return "";
}