creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pottlin...@apache.org
Subject svn commit: r1820237 - in /creadur/rat/trunk: apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java src/changes/changes.xml
Date Thu, 04 Jan 2018 22:40:38 GMT
Author: pottlinger
Date: Thu Jan  4 22:40:38 2018
New Revision: 1820237

URL: http://svn.apache.org/viewvc?rev=1820237&view=rev
Log:
RAT-242: Use UTF-8 as default encoding for written reports

Thanks to Matthias Bläsing
https://github.com/apache/creadur-rat/pull/8

Modified:
    creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
    creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java
    creadur/rat/trunk/src/changes/changes.xml

Modified: creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java?rev=1820237&r1=1820236&r2=1820237&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
(original)
+++ creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
Thu Jan  4 22:40:38 2018
@@ -34,9 +34,12 @@ import org.apache.rat.report.claim.Claim
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
 
 /**
  * Run Rat to perform a violation check.
@@ -99,9 +102,11 @@ public class RatCheckMojo extends Abstra
 
     private ClaimStatistic getRawReport()
             throws MojoExecutionException, MojoFailureException {
-        FileWriter fw = null;
+        Writer fw = null;
         try {
-            fw = new FileWriter(reportFile);
+            fw = new OutputStreamWriter(
+                   new FileOutputStream(reportFile), 
+                   Charset.forName("UTF-8"));
             final ClaimStatistic statistic = createReport(fw, getStyleSheet());
             fw.close();
             fw = null;

Modified: creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java?rev=1820237&r1=1820236&r2=1820237&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java (original)
+++ creadur/rat/trunk/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java Thu
Jan  4 22:40:38 2018
@@ -31,19 +31,20 @@ package org.apache.rat.anttasks;
  import org.apache.tools.ant.taskdefs.LogOutputStream;
  import org.apache.tools.ant.types.EnumeratedAttribute;
  import org.apache.tools.ant.types.Resource;
- import org.apache.tools.ant.types.ResourceCollection;
- import org.apache.tools.ant.types.resources.Union;
- import org.apache.tools.ant.util.FileUtils;
-
- import javax.xml.transform.TransformerException;
- import java.io.File;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStreamWriter;
- import java.io.PrintWriter;
- import java.util.ArrayList;
- import java.util.List;
+import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.Union;
+import org.apache.tools.ant.util.FileUtils;
+
+import javax.xml.transform.TransformerException;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * A basic Ant task that generates a report on all files specified by
@@ -188,8 +189,8 @@ public class Report extends Task {
             if (reportFile == null) {
                 out = new PrintWriter(
                           new OutputStreamWriter(
-                              new LogOutputStream(this, Project.MSG_INFO)
-                              )
+                              new LogOutputStream(this, Project.MSG_INFO),
+                              Charset.forName("UTF-8"))
                           );
             } else {
                 out = new PrintWriter(new FileWriter(reportFile));

Modified: creadur/rat/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/src/changes/changes.xml?rev=1820237&r1=1820236&r2=1820237&view=diff
==============================================================================
--- creadur/rat/trunk/src/changes/changes.xml (original)
+++ creadur/rat/trunk/src/changes/changes.xml Thu Jan  4 22:40:38 2018
@@ -55,6 +55,9 @@ The <action> type attribute can be add,u
 
   <body>
     <release version="0.13" date="2017-xx-xx" description="Current SNAPSHOT - to be done">
+      <action issue="RAT-242" type="fix" due-to="Matthias Bläsing" dev="pottlinger">
+	Use UTF-8 as default encoding for RAT Ant reports.
+      </action>
       <action issue="RAT-234" type="fix" due-to="ajbanck" dev="pottlinger">
 	Do not treat TypeScript files as binary.
       </action>



Mime
View raw message