This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 5d59edf  GROOVY-9475: Groovy Ant task has an option to specify the 
output file but not the file encoding (minor refactor)
5d59edf is described below

commit 5d59edfed0104111c6e1f0a467770163ee7a2844
Author: Paul King <[email protected]>
AuthorDate: Thu Mar 19 23:32:57 2020 +1000

    GROOVY-9475: Groovy Ant task has an option to specify the output file but 
not the file encoding (minor refactor)
---
 .../groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java 
b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java
index 03d0870..8cca415 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java
@@ -52,6 +52,7 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.io.Writer;
 import java.lang.reflect.Field;
+import java.nio.charset.Charset;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Vector;
@@ -320,9 +321,8 @@ public class Groovy extends Java {
                     log.verbose("Opening PrintStream to output file " + 
output);
                     BufferedOutputStream bos = new BufferedOutputStream(
                             new FileOutputStream(output.getAbsolutePath(), 
append));
-                    out = (encoding == null || encoding.isEmpty())
-                            ? new PrintStream(bos)
-                            : new PrintStream(bos, false, encoding);
+                    out = new PrintStream(bos, false,
+                            (encoding == null || encoding.isEmpty()) ? 
Charset.defaultCharset().name() : encoding);
                 }
 
                 // if there are no groovy statements between the enclosing 
Groovy tags

Reply via email to