This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch io
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git

commit 0abb8dfa2409bdc64bc205d1024b65abc02b3c58
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Sun Sep 20 07:45:58 2020 -0400

    avoid PrintWriter
---
 src/main/java/org/apache/maven/plugins/ear/EarMojo.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java 
b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
index fc11dd3..c21493f 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
@@ -21,8 +21,10 @@ package org.apache.maven.plugins.ear;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.PrintWriter;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -890,9 +892,11 @@ public class EarMojo
             mf.getMainSection().addConfiguredAttribute( classPath );
 
             // Write the manifest to disk
-            PrintWriter pw = new PrintWriter( newCreatedManifestFile );
-            mf.write( pw );
-            pw.close();
+            try ( FileOutputStream out = new FileOutputStream( 
newCreatedManifestFile );
+                  OutputStreamWriter writer = new OutputStreamWriter( out, 
StandardCharsets.UTF_8 ) )
+            {
+                mf.write( writer );
+            }
 
             if ( original.isFile() )
             {

Reply via email to