len548 commented on code in PR #7182:
URL: https://github.com/apache/ozone/pull/7182#discussion_r1754094281


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/protocolPB/OMPBHelper.java:
##########
@@ -242,11 +242,20 @@ public static MD5MD5Crc32FileChecksumProto convert(
     DataOutputBuffer buf = new DataOutputBuffer();
     checksum.write(buf);
     byte[] bytes = buf.getData();
-    DataInputBuffer buffer = new DataInputBuffer();
-    buffer.reset(bytes, 0, bytes.length);
-    int bytesPerCRC = buffer.readInt();
-    long crcPerBlock = buffer.readLong();
-    buffer.close();
+    DataInputBuffer buffer = null;
+    int bytesPerCRC;
+    long crcPerBlock;
+    try {
+      buffer = new DataInputBuffer();
+      buffer.reset(bytes, 0, bytes.length);
+      bytesPerCRC = buffer.readInt();
+      crcPerBlock = buffer.readLong();
+    } catch (IOException e) {
+      throw new RuntimeException(e);

Review Comment:
   I see. I was not sure the type of the exceptions in this case. Thank you for 
the advice. I committed the change you suggested (try-with-resources) so I will 
resolve this conversation.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to