This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git
commit e59e140e8b8ca51792fcbd1fc273817ccd125fe1 Author: Daniel Sun <[email protected]> AuthorDate: Sat Apr 11 21:20:42 2020 +0800 Trivial refactoring: Standard Charset object can be used (cherry picked from commit 8eac2c8e8517e2f84e066d86476f6f772637b8fa) --- 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) {
