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

sunlan 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 8eac2c8  Trivial refactoring: Standard Charset object can be used
8eac2c8 is described below

commit 8eac2c8e8517e2f84e066d86476f6f772637b8fa
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Apr 11 21:20:42 2020 +0800

    Trivial refactoring: Standard Charset object can be used
---
 subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java 
b/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java
index 7880cbd..db8d8bb 100644
--- a/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java
+++ b/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java
@@ -48,9 +48,9 @@ import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 /**
  * Used for pretty printing XML content and other XML related utilities.
@@ -437,12 +437,7 @@ public class XmlUtil {
     }
 
     private static void serialize(Source source, OutputStream os) {
-        try {
-            serialize(source, new StreamResult(new OutputStreamWriter(os, 
"UTF-8")));
-        }
-        catch (UnsupportedEncodingException e) {
-            // ignore
-        }
+        serialize(source, new StreamResult(new OutputStreamWriter(os, 
StandardCharsets.UTF_8)));
     }
 
     private static void serialize(Source source, Writer w) {

Reply via email to