You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2019/12/23 09:12:07 UTC

[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #387: HDDS-2787. Use try-with-resources or close resource in finally block

adoroszlai commented on a change in pull request #387: HDDS-2787. Use try-with-resources or close resource in finally block
URL: https://github.com/apache/hadoop-ozone/pull/387#discussion_r360814142
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java
 ##########
 @@ -203,10 +203,9 @@ protected void incrementCounter(Statistic objectsRead) {
   public OzoneFSOutputStream createFile(String key, boolean overWrite,
       boolean recursive) throws IOException {
     incrementCounter(Statistic.OBJECTS_CREATED);
-    try {
-      OzoneOutputStream ozoneOutputStream = bucket
-          .createFile(key, 0, replicationType, replicationFactor, overWrite,
-              recursive);
+    try (OzoneOutputStream ozoneOutputStream = bucket
+        .createFile(key, 0, replicationType, replicationFactor, overWrite,
+            recursive)) {
 
 Review comment:
   This stream is returned to the caller for writing.  It cannot be closed in this method.

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org