You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2019/03/25 02:49:11 UTC
[GitHub] [bookkeeper] sijie commented on a change in pull request #1997: Fix
error message for unrecognized number-of-bookies
sijie commented on a change in pull request #1997: Fix error message for unrecognized number-of-bookies
URL: https://github.com/apache/bookkeeper/pull/1997#discussion_r268474828
##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
##########
@@ -428,25 +428,32 @@ private void serializeLocalBookieConfig(ServerConfiguration localBookieConfig, S
Iterator<String> keys = localBookieConfig.getKeys();
try (PrintWriter writer = new PrintWriter(localBookieConfFile, "UTF-8")) {
while (keys.hasNext()) {
- String key = keys.next().toString();
+ String key = keys.next();
String[] values = localBookieConfig.getStringArray(key);
StringBuilder concatenatedValue = new StringBuilder(values[0]);
for (int i = 1; i < values.length; i++) {
- concatenatedValue.append("," + values[i]);
+ concatenatedValue.append(",").append(values[i]);
}
writer.println(key + "=" + concatenatedValue.toString());
}
}
}
- public static void main(String[] args) throws Exception, SecurityException {
+ public static void main(String[] args) {
try {
if (args.length < 1) {
usage();
System.exit(-1);
}
- int numBookies = Integer.parseInt(args[0]);
+ int numBookies = 0;
+ try {
+ numBookies = Integer.parseInt(args[0]);
+ } catch (NumberFormatException nfe) {
+ LOG.error("Unrecognized number-of-bookies: " + args[0]);
Review comment:
nit: use `{}`
```suggestion
LOG.error("Unrecognized number-of-bookies: {}", args[0]);
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services