[groovy] branch master updated: GROOVY-9475: Groovy Ant task has an option to specify the output file but not the file encoding (adjust new property name to be more explicit)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[groovy] branch master updated: GROOVY-9475: Groovy Ant task has an option to specify the output file but not the file encoding (adjust new property name to be more explicit)

paulk
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 1c08630  GROOVY-9475: Groovy Ant task has an option to specify the output file but not the file encoding (adjust new property name to be more explicit)
1c08630 is described below

commit 1c08630b5aa03110c1d85121600768493441c73e
Author: Paul King <[hidden email]>
AuthorDate: Wed Mar 25 16:13:31 2020 +1000

    GROOVY-9475: Groovy Ant task has an option to specify the output file but not the file encoding (adjust new property name to be more explicit)
---
 .../src/main/java/org/codehaus/groovy/ant/Groovy.java       | 13 +++++++------
 1 file changed, 7 insertions(+), 6 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 a2cbcc8..7ec8aef 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
@@ -67,10 +67,11 @@ public class Groovy extends Java {
     private static final String PREFIX = "embedded_script_in_";
     private static final String SUFFIX = "groovy_Ant_task";
     private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
     /**
-     * encoding; set to null or empty means 'default'
+     * output encoding; set to null or empty means 'default'
      */
-    private String encoding = null;
+    private String outputEncoding = null;
 
     private final LoggingHelper log = new LoggingHelper(this);
 
@@ -130,13 +131,13 @@ public class Groovy extends Java {
 
     /**
      * Declare the encoding to use when outputting to a file;
-     * Use "" for the platform's default encoding.
+     * Leave unspecified or use "" for the platform's default encoding.
      *
      * @param encoding the character encoding to use.
      * @since 3.0.3
      */
-    public void setEncoding(String encoding) {
-        this.encoding = encoding;
+    public void setOutputEncoding(String encoding) {
+        this.outputEncoding = encoding;
     }
 
     /**
@@ -326,7 +327,7 @@ public class Groovy extends Java {
                     BufferedOutputStream bos = new BufferedOutputStream(
                             new FileOutputStream(output.getAbsolutePath(), append));
                     out = new PrintStream(bos, false,
-                            (encoding == null || encoding.isEmpty()) ? Charset.defaultCharset().name() : encoding);
+                            (outputEncoding == null || outputEncoding.isEmpty()) ? Charset.defaultCharset().name() : outputEncoding);
                 }
 
                 // if there are no groovy statements between the enclosing Groovy tags