You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "javeme (via GitHub)" <gi...@apache.org> on 2023/03/02 13:21:09 UTC
[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #2095: refact: mark TODO in the license problem code & use standard UTF-8
javeme commented on code in PR #2095:
URL: https://github.com/apache/incubator-hugegraph/pull/2095#discussion_r1123076734
##########
hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java:
##########
@@ -137,26 +127,30 @@ public static byte[] compress(String value) {
}
public static byte[] compress(String value, float bufferRatio) {
- BytesBuffer buf = LZ4Util.compress(encode(value), BLOCK_SIZE,
- bufferRatio);
- return buf.bytes();
+ try (BytesBuffer buf = LZ4Util.compress(encode(value), BLOCK_SIZE, bufferRatio)) {
+ return buf.bytes();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
Review Comment:
wrap a message for the re-throw, like "Failed to compress xx"
##########
hugegraph-core/src/main/java/org/apache/hugegraph/util/StringEncoding.java:
##########
@@ -137,18 +129,23 @@ public static byte[] compress(String value) {
}
public static byte[] compress(String value, float bufferRatio) {
- BytesBuffer buf = LZ4Util.compress(encode(value), BLOCK_SIZE,
- bufferRatio);
- return buf.bytes();
+ try (BytesBuffer buf = LZ4Util.compress(encode(value), BLOCK_SIZE, bufferRatio)) {
+ return buf.bytes();
+ } catch (IOException e) {
Review Comment:
yes just remove the catch, since the LZ4Util.compress already transfer IOException to BackendException
--
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: dev-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org