You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/04/11 13:51:16 UTC

[GitHub] [maven-shade-plugin] elharo opened a new pull request #44: [MSHADE-360] avoid PrintWriter

elharo opened a new pull request #44: [MSHADE-360] avoid PrintWriter
URL: https://github.com/apache/maven-shade-plugin/pull/44
 
 
   @hboutemy this is also a tad more careful about character encodings

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-shade-plugin] elharo commented on a change in pull request #44: [MSHADE-360] avoid PrintWriter

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-shade-plugin] michael-o commented on a change in pull request #44: [MSHADE-360] avoid PrintWriter

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #44: [MSHADE-360] avoid PrintWriter
URL: https://github.com/apache/maven-shade-plugin/pull/44#discussion_r407183652
 
 

 ##########
 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:
   System.lineSeparator()?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-shade-plugin] elharo merged pull request #44: [MSHADE-360] avoid PrintWriter

Posted by GitBox <gi...@apache.org>.
elharo merged pull request #44: [MSHADE-360] avoid PrintWriter
URL: https://github.com/apache/maven-shade-plugin/pull/44
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services