elharo commented on a change in pull request #44: [MSHADE-360] avoid PrintWriter
URL: https://github.com/apache/maven-shade-plugin/pull/44#discussion_r407184706
 
 

 ##########
 File path: 
src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java
 ##########
 @@ -136,15 +137,17 @@ public void modifyOutputStream( JarOutputStream jos )
             jos.putNextEntry( jarEntry );
 
 
-            //read the content of service file for candidate classes for 
relocation
-            PrintWriter writer = new PrintWriter( jos );
+            // read the content of service file for candidate classes for 
relocation.
+            // Specification requires that this file is encoded in UTF-8.
+            Writer writer = new OutputStreamWriter( jos, 
StandardCharsets.UTF_8 );
             InputStreamReader streamReader = new InputStreamReader( 
data.toInputStream() );
             BufferedReader reader = new BufferedReader( streamReader );
             String className;
 
             while ( ( className = reader.readLine() ) != null )
             {
-                writer.println( className );
+                writer.write( className );
+                writer.write( System.getProperty( "line.separator" ) );
 
 Review comment:
   good idea. done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to