[testng] 155/355: CustomizedSuites must be saved using utf-8 encoding

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:19:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit d78e91f2fc48a908b03baebf51f01ad870b33a37
Author: Juha Heljoranta <juha.heljoranta at iki.fi>
Date:   Sat Feb 21 16:54:15 2015 +0200

    CustomizedSuites must be saved using utf-8 encoding
    
    Default XMLStringBuffer constructor sets XML encoding to UTF-8.
    FileWriter uses default platform encoding resulting potentially
    invalid xml files.
---
 src/main/java/org/testng/xml/LaunchSuite.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/testng/xml/LaunchSuite.java b/src/main/java/org/testng/xml/LaunchSuite.java
index dd0f8e4..9731b25 100755
--- a/src/main/java/org/testng/xml/LaunchSuite.java
+++ b/src/main/java/org/testng/xml/LaunchSuite.java
@@ -10,8 +10,10 @@ import org.testng.remote.RemoteTestNG;
 import org.testng.reporters.XMLStringBuffer;
 
 import java.io.File;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.Charset;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -205,7 +207,7 @@ public abstract class LaunchSuite {
     protected void saveSuiteContent(final File file, final XMLStringBuffer content) {
 
       try {
-        FileWriter fw = new FileWriter(file);
+        OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8"));
         try {
           fw.write(content.getStringBuffer().toString());
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list