Updated Branches:
  refs/heads/master 5b6e64552 -> bb6b24607

o When writing console output to file, do not convert it to some encoding, but 
print it byte-for-byte.


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/bb6b2460
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/bb6b2460
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/bb6b2460

Branch: refs/heads/master
Commit: bb6b24607837b112f81658ea15232debe1a6b22b
Parents: 5b6e645
Author: Andreas Gudian <agud...@apache.org>
Authored: Sun Jul 28 22:43:31 2013 +0200
Committer: Andreas Gudian <agud...@apache.org>
Committed: Sun Jul 28 22:43:31 2013 +0200

----------------------------------------------------------------------
 .../report/ConsoleOutputFileReporter.java       | 29 ++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bb6b2460/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
index 3d84b2a..7aeb1f7 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
@@ -19,11 +19,10 @@ package org.apache.maven.plugin.surefire.report;
  * under the License.
  */
 
-import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.PrintWriter;
+
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.util.NestedRuntimeException;
@@ -43,10 +42,10 @@ public class ConsoleOutputFileReporter
 
     private final String reportNameSuffix;
 
-    private PrintWriter printWriter = null;
-
     private String reportEntryName;
 
+    private FileOutputStream fileOutputStream;
+
     public ConsoleOutputFileReporter( File reportsDirectory, String 
reportNameSuffix )
     {
         this.reportsDirectory = reportsDirectory;
@@ -66,10 +65,18 @@ public class ConsoleOutputFileReporter
 
     public void close()
     {
-        if ( printWriter != null )
+        if ( fileOutputStream != null )
         {
-            printWriter.close();
-            printWriter = null;
+            try
+            {
+                fileOutputStream.flush();
+                fileOutputStream.close();
+            }
+            catch ( IOException e )
+            {
+                ;
+            }
+            fileOutputStream = null;
         }
     }
 
@@ -77,7 +84,7 @@ public class ConsoleOutputFileReporter
     {
         try
         {
-            if ( printWriter == null )
+            if ( fileOutputStream == null )
             {
                 if ( !reportsDirectory.exists() )
                 {
@@ -86,9 +93,9 @@ public class ConsoleOutputFileReporter
                 }
                 File file =
                     FileReporter.getReportFile( reportsDirectory, 
reportEntryName, reportNameSuffix, "-output.txt" );
-                printWriter = new PrintWriter( new BufferedWriter( new 
FileWriter( file ) ) );
+                fileOutputStream = new FileOutputStream( file );
             }
-            printWriter.write( new String( buf, off, len ) );
+            fileOutputStream.write( buf, off, len );
         }
         catch ( IOException e )
         {

Reply via email to