You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/07/16 14:40:29 UTC

[GitHub] [maven-resources-plugin] elharo opened a new pull request #5: try with resources

elharo opened a new pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5


   @roxspring


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



[GitHub] [maven-resources-plugin] elharo commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r456426774



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       close also flushes




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



[GitHub] [maven-resources-plugin] pzygielo commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r456444223



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       I think @roxspring is right about FOS not wrapped in BOS not being problem for flushing or not. But I'm not sure that
   > close also flushes
   
   is true. There is `flush` called in `FOS.finalize` ~but `close` inherited from `OutputStream` is no-op~ (immaterial), as `FOS.close` doesn't seem to call flush neither.




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



[GitHub] [maven-resources-plugin] pzygielo commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r456444223



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       I think @roxspring is right about FOS not wrapped in BOS not being problem for flushing or not. But I'm not sure that
   > close also flushes
   
   is true. There is `flush` called in `FOS.finalize` ~but `close` inherited from `OutputStream` is no-op~ (immaterial), as `FOS.close` doesn't seem to call flush neither.
   
   On the other hand - `close` of `BufferedOutputStream` flushes indeed.




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



[GitHub] [maven-resources-plugin] pzygielo commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r456444223



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       I think @roxspring is right about FOS not wrapped in BOS not being problem for flushing or not. But I'm not sure that
   > close also flushes
   
   is true. There is `flush` called in `FOS.finalize` but `close` inherited from `OutputStream` is no-op.




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



[GitHub] [maven-resources-plugin] roxspring commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
roxspring commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r455856767



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       Don't think the `.flush()` is guaranteed by try-with-resources... but perhaps by not wrapping FOS in a BufferedOutputStream then that's not a problem?




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



[GitHub] [maven-resources-plugin] pzygielo commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
pzygielo commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r456444223



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       <sup>~I think @roxspring is right about FOS not wrapped in BOS not being problem for flushing or not. But I'm not sure that close also flushes. There is `flush` called in `FOS.finalize` but `close` inherited from `OutputStream` is no-op (immaterial), as `FOS.close` doesn't seem to call flush neither.~</sup>
   <sup>~On the other hand~</sup> `close` of `BufferedOutputStream` flushes indeed.




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



[GitHub] [maven-resources-plugin] rmannibucau commented on a change in pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on a change in pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5#discussion_r456447966



##########
File path: src/test/java/org/apache/maven/plugins/resources/stub/MavenProjectBuildStub.java
##########
@@ -300,8 +293,6 @@ private void populateFile( File file ) throws IOException
             try ( FileOutputStream outputStream = new FileOutputStream( file ) )
             {
                 outputStream.write( data.getBytes() );
-                outputStream.flush();

Review comment:
       Calling flush just before close is generally useless cause close ensures all data have been written.
   That said we are speaking of a FileOutputStream where flush() is a noop so it is even safer to drop.




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



[GitHub] [maven-resources-plugin] elharo merged pull request #5: try with resources

Posted by GitBox <gi...@apache.org>.
elharo merged pull request #5:
URL: https://github.com/apache/maven-resources-plugin/pull/5


   


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