maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r652602 - /maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java
Date Thu, 01 May 2008 18:15:02 GMT
Author: bentmann
Date: Thu May  1 11:15:02 2008
New Revision: 652602

URL: http://svn.apache.org/viewvc?rev=652602&view=rev
Log:
[MSHADE-27] Use platform-independent file encoding for processing of NOTICE file

o Partly reverted to keep using platform encoding by default

Modified:
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java?rev=652602&r1=652601&r2=652602&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java
Thu May  1 11:15:02 2008
@@ -25,6 +25,7 @@
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.Writer;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Iterator;
@@ -36,6 +37,8 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 
+import org.codehaus.plexus.util.StringUtils;
+
 public class ApacheNoticeResourceTransformer
     implements ResourceTransformer
 {
@@ -64,7 +67,7 @@
     /**
      * The file encoding of the <code>NOTICE</code> file.
      */
-    String encoding = "ISO-8859-1";
+    String encoding;
 
     private static final String NOTICE_PATH = "META-INF/NOTICE";
 
@@ -107,7 +110,15 @@
         }
 
 
-        BufferedReader reader = new BufferedReader( new InputStreamReader( is, encoding )
);
+        BufferedReader reader;
+        if ( StringUtils.isNotEmpty( encoding ) )
+        {
+            reader = new BufferedReader( new InputStreamReader( is, encoding ) );
+        }
+        else
+        {
+            reader = new BufferedReader( new InputStreamReader( is ) );
+        }
 
         String line = reader.readLine();
         StringBuffer sb = new StringBuffer();
@@ -192,7 +203,15 @@
     {
         jos.putNextEntry( new JarEntry( NOTICE_PATH ) );
 
-        OutputStreamWriter pow = new OutputStreamWriter( jos, encoding );
+        Writer pow;
+        if ( StringUtils.isNotEmpty( encoding ) )
+        {
+            pow = new OutputStreamWriter( jos, encoding );
+        }
+        else
+        {
+            pow = new OutputStreamWriter( jos );
+        }
         PrintWriter writer = new PrintWriter( pow );
 
         int count = 0;



Mime
View raw message