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

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


The following commit(s) were added to refs/heads/clean by this push:
     new c14ba55  linefeed
c14ba55 is described below

commit c14ba55f6c1c890f6c52c91a30c9fba82290f554
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Tue Nov 26 11:21:16 2024 -0500

    linefeed
---
 .../java/org/apache/maven/archiver/PomPropertiesUtil.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java 
b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
index 391ed77..81e8b6e 100644
--- a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
+++ b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
@@ -21,9 +21,9 @@ package org.apache.maven.archiver;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.io.Writer;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -71,8 +71,8 @@ public class PomPropertiesUtil {
             return;
         }
 
-        try (PrintWriter pw = new PrintWriter(outputFile.toFile(), 
StandardCharsets.ISO_8859_1);
-                StringWriter sw = new StringWriter()) {
+        try ( Writer writer = Files.newBufferedWriter(outputFile, 
StandardCharsets.ISO_8859_1);
+              StringWriter sw = new StringWriter()) {
 
             properties.store(sw, null);
 
@@ -87,8 +87,9 @@ public class PomPropertiesUtil {
             }
 
             Collections.sort(lines);
-            for (String l : lines) {
-                pw.println(l);
+            for (String line : lines) {
+                writer.write(line);
+                writer.write( '\n' );
             }
         }
     }

Reply via email to