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

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


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

commit 9965f56304ae790cd4e49ee251e47f30a3573198
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