You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/07/26 06:39:42 UTC

[GitHub] [commons-io] rbri commented on a change in pull request #251: [IO-744] FileWriterWithEncoding for an existing file no longer truncates the file.

rbri commented on a change in pull request #251:
URL: https://github.com/apache/commons-io/pull/251#discussion_r676328916



##########
File path: src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
##########
@@ -227,7 +227,12 @@ private static Writer initWriter(final File file, final Object encoding, final b
         OutputStream stream = null;
         final boolean fileExistedAlready = file.exists();
         try {
-            stream = Files.newOutputStream(file.toPath(),  append ? StandardOpenOption.APPEND : StandardOpenOption.CREATE);
+            if (append) {

Review comment:
       @garydgregory Thanks for the warm welcome as someone trying to help.
   Have done another PR that shows, that your optimized version of the fix now breaks the ctor with the append option set to true.




-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org