ztzg commented on a change in pull request #934: ZOOKEEPER-3301:Enforce the
quota limit
URL: https://github.com/apache/zookeeper/pull/934#discussion_r357054721
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/cli/DelQuotaCommand.java
##########
@@ -109,17 +123,11 @@ public static boolean delQuota(ZooKeeper zk, String path,
} catch (IllegalArgumentException ex) {
throw new MalformedPathException(ex.getMessage());
} catch (KeeperException.NoNodeException ne) {
- System.err.println("quota does not exist for " + path);
- return true;
+ throw new KeeperException.NoNodeException(ne.getMessage());
}
StatsTrack strack = new StatsTrack(new String(data));
Review comment:
This assumes that [the "platform's default
charset"](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#String-byte:A-)
is ASCII-compatible. I would suggest being explicit about
[US-ASCII](https://docs.oracle.com/javase/8/docs/api/java/nio/charset/StandardCharsets.html#US_ASCII)
here:
```java
import static java.nio.charset.StandardCharsets.US_ASCII;
[...]
new String(data, US_ASCII)
```
Also: there are quite a few instances of `new StatsTrack(new String(data))`
in this patch; wouldn't it be better to just add a constructor which takes a
`byte[]`?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services